/ Check-in [fdd478bb]
Login

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

Overview
Comment:Improved WHERETRACE messages for the estimated output row reductions from range scans.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fdd478bb11eb9e244a7a1fb628ac27c53830fb24
User & Date: drh 2014-08-28 19:38:22
Context
2014-08-29
14:20
Not a fault after all, rather a testing mistake. Move this change back to trunk. Was: Avoid an unnecessary OP_Move operation for expression subqueries. check-in: 2a74129a user: drh tags: trunk
12:29
Contains a fault. Was: Avoid an unnecessary OP_Move operation for expression subqueries. Closed-Leaf check-in: 462f42af user: drh tags: mistake
11:24
Add the sqlite3VdbeChangeDest() routine that can be used to eliminate OP_Move opcodes. Closed-Leaf check-in: 8c57bcc3 user: drh tags: experimental
2014-08-28
19:38
Improved WHERETRACE messages for the estimated output row reductions from range scans. check-in: fdd478bb user: drh tags: trunk
17:30
Fix a problem causing an inaccurate stat4-based estimate for the number of rows visited by a range scan. check-in: a9daf3ac user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  2250   2250             nNew = sqlite3LogEst(iUpper - iLower);
  2251   2251           }else{
  2252   2252             nNew = 10;        assert( 10==sqlite3LogEst(2) );
  2253   2253           }
  2254   2254           if( nNew<nOut ){
  2255   2255             nOut = nNew;
  2256   2256           }
  2257         -        WHERETRACE(0x10, ("range scan regions: %u..%u  est=%d\n",
         2257  +        WHERETRACE(0x10, ("STAT4 range scan: %u..%u  est=%d\n",
  2258   2258                              (u32)iLower, (u32)iUpper, nOut));
  2259   2259         }
  2260   2260       }else{
  2261   2261         int bDone = 0;
  2262   2262         rc = whereRangeSkipScanEst(pParse, pLower, pUpper, pLoop, &bDone);
  2263   2263         if( bDone ) return rc;
  2264   2264       }
................................................................................
  2278   2278     ** index. While a closed range (e.g. col BETWEEN ? AND ?) is estimated to
  2279   2279     ** match 1/64 of the index. */ 
  2280   2280     if( pLower && pUpper ) nNew -= 20;
  2281   2281   
  2282   2282     nOut -= (pLower!=0) + (pUpper!=0);
  2283   2283     if( nNew<10 ) nNew = 10;
  2284   2284     if( nNew<nOut ) nOut = nNew;
         2285  +#if defined(WHERETRACE_ENABLED)
         2286  +  if( pLoop->nOut>nOut ){
         2287  +    WHERETRACE(0x10,("Range scan lowers nOut from %d to %d\n",
         2288  +                    pLoop->nOut, nOut));
         2289  +  }
         2290  +#endif
  2285   2291     pLoop->nOut = (LogEst)nOut;
  2286   2292     return rc;
  2287   2293   }
  2288   2294   
  2289   2295   #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
  2290   2296   /*
  2291   2297   ** Estimate the number of rows that will be returned based on