Add test cases and fix a comment.

FossilOrigin-Name: 50f8ea37fb9647c4a9da2c269a4d6f54b10ce96b
This commit is contained in:
drh
2016-07-27 19:20:58 +00:00
parent 2409f8a112
commit e604ec0be0
6 changed files with 78 additions and 20 deletions
+4 -4
View File
@@ -3994,10 +3994,10 @@ static int exprIdxCover(Walker *pWalker, Expr *pExpr){
}
/*
** Determine if an index on table iCur that contains the columns in
** Bitmask m will cover the expression pExpr. Return true if the index
** does cover the expression and false if the expression references
** table columns that are not found in the index.
** Determine if an index pIdx on table with cursor iCur contains will
** the expression pExpr. Return true if the index does cover the
** expression and false if the pExpr expression references table columns
** that are not found in the index pIdx.
**
** An index covering an expression means that the expression can be
** evaluated using only the index and without having to lookup the
+2 -2
View File
@@ -2478,11 +2478,11 @@ static int whereLoopAddBtreeIndex(
pNew->nSkip++;
pNew->aLTerm[pNew->nLTerm++] = 0;
pNew->wsFlags |= WHERE_SKIPSCAN;
nIter = pProbe->aiRowLogEst[saved_nEq] - pProbe->aiRowLogEst[saved_nEq+1];
nIter = pProbe->aiRowLogEst[saved_nEq]+1 - pProbe->aiRowLogEst[saved_nEq+1];
pNew->nOut -= nIter;
/* TUNING: Because uncertainties in the estimates for skip-scan queries,
** add a 1.375 fudge factor to make skip-scan slightly less likely. */
nIter += 5;
nIter += 4;
whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
pNew->nOut = saved_nOut;
pNew->u.btree.nEq = saved_nEq;