mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-03 16:53:36 +03:00
The top of an index equality loop normally starts with OP_SeekGE and OP_IdxGT.
This check-in adds a flag to OP_SeekGE such that it fails immediately if the key is not equal, then jumps over the OP_IdxGT, saving a call to the key comparison functions. Consider this check-in a proof-of-concept. It needs improvement before going on trunk. Some tests fail, but only because they new use fewer key comparisons than expected (which is a good thing!). FossilOrigin-Name: 32e31b9bc8664afcd326a1ff3892d86dc5202474
This commit is contained in:
@@ -3969,6 +3969,7 @@ int sqlite3VdbeRecordCompareWithSkip(
|
||||
|| vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, pPKey2->default_rc)
|
||||
|| pKeyInfo->db->mallocFailed
|
||||
);
|
||||
pPKey2->eqSeen = 1;
|
||||
return pPKey2->default_rc;
|
||||
}
|
||||
int sqlite3VdbeRecordCompare(
|
||||
@@ -4068,6 +4069,7 @@ static int vdbeRecordCompareInt(
|
||||
/* The first fields of the two keys are equal and there are no trailing
|
||||
** fields. Return pPKey2->default_rc in this case. */
|
||||
res = pPKey2->default_rc;
|
||||
pPKey2->eqSeen = 1;
|
||||
}
|
||||
|
||||
assert( vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, res) );
|
||||
@@ -4114,6 +4116,7 @@ static int vdbeRecordCompareString(
|
||||
res = sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 1);
|
||||
}else{
|
||||
res = pPKey2->default_rc;
|
||||
pPKey2->eqSeen = 1;
|
||||
}
|
||||
}else if( res>0 ){
|
||||
res = pPKey2->r2;
|
||||
|
||||
Reference in New Issue
Block a user