/ Check-in [31b4e63b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid using left-most column STAT3 samples if the left-most column has an equality constrain and there are inequality constraints on the second column.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 31b4e63b3c30fcad22340d84d6076a306f26b49e
User & Date: drh 2013-08-01 16:52:50
Context
2013-08-01
17:21
An improved method for avoiding the use of the STAT3 samples to compute the estimated number of outputs when the left-most index is equality constrained. This check-in undoes the previous fix and applies a new one. check-in: 127a5b77 user: drh tags: trunk
16:52
Avoid using left-most column STAT3 samples if the left-most column has an equality constrain and there are inequality constraints on the second column. check-in: 31b4e63b user: drh tags: trunk
2013-07-31
23:28
Limit the number of memset() calls used when determining a temporary file name on Windows. Also, fix a harmless compiler warning. check-in: 136fc293 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  4416   4416         /* Adjust nOut and rRun for STAT3 range values */
  4417   4417         WhereCost rDiv;
  4418   4418         whereRangeScanEst(pParse, pProbe, pNew->u.btree.nEq,
  4419   4419                           pBtm, pTop, &rDiv);
  4420   4420         pNew->nOut = saved_nOut>rDiv+10 ? saved_nOut - rDiv : 10;
  4421   4421       }
  4422   4422   #ifdef SQLITE_ENABLE_STAT3
  4423         -    if( pNew->u.btree.nEq==1 && pProbe->nSample
         4423  +    if( pNew->u.btree.nEq==1 && pProbe->nSample && saved_nEq==0
  4424   4424        &&  OptimizationEnabled(db, SQLITE_Stat3) ){
  4425   4425         tRowcnt nOut = 0;
  4426   4426         if( (pTerm->eOperator & (WO_EQ|WO_ISNULL))!=0 ){
  4427   4427           testcase( pTerm->eOperator & WO_EQ );
  4428   4428           testcase( pTerm->eOperator & WO_ISNULL );
  4429   4429           rc = whereEqualScanEst(pParse, pProbe, pTerm->pExpr->pRight, &nOut);
  4430   4430         }else if( (pTerm->eOperator & WO_IN)