diff options
author | drh <drh@noemail.net> | 2018-06-05 15:16:25 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-06-05 15:16:25 +0000 |
commit | 86d0ea755844cc3ace4800cfb1400d18bc067ccb (patch) | |
tree | 406565c53b0d3d4e7283e09ebdd9a66b851cbddc /src/wherecode.c | |
parent | 995bbbf99354ce0fa6b5802b3b01c2ecbc0aa2a2 (diff) | |
download | sqlite-86d0ea755844cc3ace4800cfb1400d18bc067ccb.tar.gz sqlite-86d0ea755844cc3ace4800cfb1400d18bc067ccb.zip |
Use an OP_NotFound opcode to cancel futile IN operators early. The current
implementation is suboptimal because it always runs teh OP_NotFound. This
still needs to be enhanced to only do the OP_NotFound if no results have been
seen on the current loop.
FossilOrigin-Name: 87a9fc504f9a78caf7a7949cc7ada0a19d61bfab51bb49a00a1607194c116212
Diffstat (limited to 'src/wherecode.c')
-rw-r--r-- | src/wherecode.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/wherecode.c b/src/wherecode.c index 157812247..1c653c9f5 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -592,8 +592,12 @@ static int codeEqualityTerm( if( i==iEq ){ pIn->iCur = iTab; pIn->eEndLoopOp = bRev ? OP_PrevIfOpen : OP_NextIfOpen; - pIn->iBase = iReg - i; - pIn->nPrefix = i; + if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){ + pIn->iBase = iReg - i; + pIn->nPrefix = i; + }else{ + pIn->nPrefix = 0; + } }else{ pIn->eEndLoopOp = OP_Noop; } |