mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-18 10:21:03 +03:00
Revisiting the IN-scan optimization to try to fix it for the corner case
where the statistics deceive the query planner into using a scan when an indexed lookup would be better. This check-in changes the code generation to do the IN-scan using a new OP_SeekScan opcode. That new opcode is designed to abandon the scan and fall back to a seek if it doesn't find a match quickly enough. For this work-in-progress check-in, OP_SeekScan is still a no-op and OP_SeekGE still ends up doing all the work. FossilOrigin-Name: d720b6981eeb0ffdb14494ca63eca298ee724ae4ad4863c7c7cbfdad7fa52519
This commit is contained in:
@@ -1804,6 +1804,11 @@ Bitmask sqlite3WhereCodeOneLoopStart(
|
||||
|
||||
op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
|
||||
assert( op!=0 );
|
||||
if( (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0 ){
|
||||
assert( op==OP_SeekGE );
|
||||
assert( regBignull==0 );
|
||||
sqlite3VdbeAddOp1(v, OP_SeekScan, 10);
|
||||
}
|
||||
sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
|
||||
VdbeCoverage(v);
|
||||
VdbeCoverageIf(v, op==OP_Rewind); testcase( op==OP_Rewind );
|
||||
|
||||
Reference in New Issue
Block a user