8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 22:43:03 +01:00

Improvement #8104 : Inefficient evaluation of expressions like rdb$db_key <= ? after mass delete

This commit is contained in:
Vlad Khorsun 2024-05-06 15:19:11 +03:00
parent aa3cafb420
commit 1e5385637d
3 changed files with 13 additions and 10 deletions

View File

@ -146,14 +146,10 @@ bool FullTableScan::internalGetRecord(thread_db* tdbb) const
return false;
}
if (VIO_next_record(tdbb, rpb, request->req_transaction, request->req_pool, DPM_next_all))
{
if (impure->irsb_upper.isValid() && rpb->rpb_number > impure->irsb_upper)
{
rpb->rpb_number.setValid(false);
return false;
}
const RecordNumber* upper = impure->irsb_upper.isValid() ? &impure->irsb_upper : nullptr;
if (VIO_next_record(tdbb, rpb, request->req_transaction, request->req_pool, DPM_next_all, upper))
{
rpb->rpb_number.setValid(true);
return true;
}

View File

@ -3759,7 +3759,8 @@ bool VIO_next_record(thread_db* tdbb,
record_param* rpb,
jrd_tra* transaction,
MemoryPool* pool,
FindNextRecordScope scope)
FindNextRecordScope scope,
const RecordNumber* upper)
{
/**************************************
*
@ -3794,9 +3795,14 @@ bool VIO_next_record(thread_db* tdbb,
rpb->rpb_f_page, rpb->rpb_f_line);
#endif
do {
do
{
if (!DPM_next(tdbb, rpb, lock_type, scope))
return false;
if (upper && rpb->rpb_number > *upper)
{
CCH_RELEASE(tdbb, &rpb->getWindow(tdbb));
return false;
}
} while (!VIO_chase_record_version(tdbb, rpb, transaction, pool, false, false));

View File

@ -67,7 +67,8 @@ bool VIO_get_current(Jrd::thread_db*, Jrd::record_param*, Jrd::jrd_tra*,
void VIO_init(Jrd::thread_db*);
Jrd::WriteLockResult VIO_writelock(Jrd::thread_db*, Jrd::record_param*, Jrd::jrd_tra*);
bool VIO_modify(Jrd::thread_db*, Jrd::record_param*, Jrd::record_param*, Jrd::jrd_tra*);
bool VIO_next_record(Jrd::thread_db*, Jrd::record_param*, Jrd::jrd_tra*, MemoryPool*, Jrd::FindNextRecordScope);
bool VIO_next_record(Jrd::thread_db*, Jrd::record_param*, Jrd::jrd_tra*, MemoryPool*,
Jrd::FindNextRecordScope, const RecordNumber* = nullptr);
Jrd::Record* VIO_record(Jrd::thread_db*, Jrd::record_param*, const Jrd::Format*, MemoryPool*);
bool VIO_refetch_record(Jrd::thread_db*, Jrd::record_param*, Jrd::jrd_tra*, bool, bool);
void VIO_store(Jrd::thread_db*, Jrd::record_param*, Jrd::jrd_tra*);