aboutsummaryrefslogtreecommitdiff
path: root/src/wherecode.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2018-06-07 14:59:22 +0000
committerdrh <drh@noemail.net>2018-06-07 14:59:22 +0000
commitf7b0a5f3c369d2e2d3d3c51a1f45203fe7841eb6 (patch)
tree5b80550d25ba7c9d7fdb92dbf4a4ef0803cef505 /src/wherecode.c
parentbd573c459b7170b979d73655c50e0e946f388169 (diff)
downloadsqlite-f7b0a5f3c369d2e2d3d3c51a1f45203fe7841eb6.tar.gz
sqlite-f7b0a5f3c369d2e2d3d3c51a1f45203fe7841eb6.zip
Add the WHERE_IN_EARLYOUT flag and use it to clarify the logic of this
optimization. FossilOrigin-Name: 522f1eacc20f11002cad58232a7c2610f369568653510e54f46088f579f778dc
Diffstat (limited to 'src/wherecode.c')
-rw-r--r--src/wherecode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wherecode.c b/src/wherecode.c
index a20a9808e..03c3b78ae 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -595,6 +595,7 @@ static int codeEqualityTerm(
if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){
pIn->iBase = iReg - i;
pIn->nPrefix = i;
+ pLoop->wsFlags |= WHERE_IN_EARLYOUT;
}else{
pIn->nPrefix = 0;
}
@@ -1664,7 +1665,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
** above has already left the cursor sitting on the correct row,
** so no further seeking is needed */
}else{
- if( pLoop->wsFlags & WHERE_IN_ABLE ){
+ if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
sqlite3VdbeAddOp1(v, OP_SeekHit, iIdxCur);
}
op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
@@ -1730,7 +1731,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE );
}
- if( pLoop->wsFlags & WHERE_IN_ABLE ){
+ if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
sqlite3VdbeAddOp2(v, OP_SeekHit, iIdxCur, 1);
}