diff options
author | drh <drh@noemail.net> | 2018-12-24 02:34:49 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-12-24 02:34:49 +0000 |
commit | 2c04131ca7e485cd6e6f0741c14b2c570c65122c (patch) | |
tree | f1f70c8d2ef62ad25f941530935a5f8a97b509be /src/wherecode.c | |
parent | 85bcdce270575e78258148c00f2efff7e81e7bc1 (diff) | |
download | sqlite-2c04131ca7e485cd6e6f0741c14b2c570c65122c.tar.gz sqlite-2c04131ca7e485cd6e6f0741c14b2c570c65122c.zip |
Experimental code that tries to put the computation of subqueries inside a
subroutine, and reuse that subroutine if the same subquery is evaluated more
than once. Current code does not work for CHECK constraints.
FossilOrigin-Name: 6c44838adbe5dc482bc010e91a6dd7a0f777c989f443dd600740d2c783208e0d
Diffstat (limited to 'src/wherecode.c')
-rw-r--r-- | src/wherecode.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/wherecode.c b/src/wherecode.c index acd72a955..946bd0eb7 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -538,16 +538,17 @@ static int codeEqualityTerm( if( pLoop->aLTerm[i]->pExpr==pX ) nEq++; } + iTab = 0; if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){ - eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0); + eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab); }else{ sqlite3 *db = pParse->db; pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX); if( !db->mallocFailed ){ aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq); - eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap); - pTerm->pExpr->iTable = pX->iTable; + eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab); + pTerm->pExpr->iTable = iTab; } sqlite3ExprDelete(db, pX); pX = pTerm->pExpr; @@ -557,7 +558,6 @@ static int codeEqualityTerm( testcase( bRev ); bRev = !bRev; } - iTab = pX->iTable; sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0); VdbeCoverageIf(v, bRev); VdbeCoverageIf(v, !bRev); @@ -2197,7 +2197,7 @@ Bitmask sqlite3WhereCodeOneLoopStart( if( pAlt->wtFlags & (TERM_CODED) ) continue; if( (pAlt->eOperator & WO_IN) && (pAlt->pExpr->flags & EP_xIsSelect) - && (pAlt->pExpr->x.pSelect->pEList->nExpr>1) +// && (pAlt->pExpr->x.pSelect->pEList->nExpr>1) ){ continue; } |