SQLite

Check-in [e0c6b8bdb7]
Login

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

Overview
Comment:Disallow the skip-scan optimization in the absence of sqlite_stat1 data.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e0c6b8bdb76fcd4f08c89ff20dce6a33ef3c11752e1e919fec5c4e7d423c4b93
User & Date: drh 2020-02-13 14:51:54.614
Context
2020-02-13
22:12
Fix problems in the constant propagation optimization that were introduced by check-in [1c3e5c20a9e6f501]. Fix for ticket [1dcb4d44964846ad] (check-in: c9a8defcef user: drh tags: trunk)
14:51
Disallow the skip-scan optimization in the absence of sqlite_stat1 data. (check-in: e0c6b8bdb7 user: drh tags: trunk)
13:45
Omit O_NOFOLLOW from the open() call when opening /dev/null, since /dev/null is a symlink on Solaris, we are told. (check-in: 0c683c43a6 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/where.c.
2728
2729
2730
2731
2732
2733
2734

2735
2736
2737
2738
2739
2740
2741
  ** On the other hand, the extra seeks could end up being significantly
  ** more expensive.  */
  assert( 42==sqlite3LogEst(18) );
  if( saved_nEq==saved_nSkip
   && saved_nEq+1<pProbe->nKeyCol
   && saved_nEq==pNew->nLTerm
   && pProbe->noSkipScan==0

   && OptimizationEnabled(db, SQLITE_SkipScan)
   && pProbe->aiRowLogEst[saved_nEq+1]>=42  /* TUNING: Minimum for skip-scan */
   && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK
  ){
    LogEst nIter;
    pNew->u.btree.nEq++;
    pNew->nSkip++;







>







2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
  ** On the other hand, the extra seeks could end up being significantly
  ** more expensive.  */
  assert( 42==sqlite3LogEst(18) );
  if( saved_nEq==saved_nSkip
   && saved_nEq+1<pProbe->nKeyCol
   && saved_nEq==pNew->nLTerm
   && pProbe->noSkipScan==0
   && pProbe->hasStat1!=0
   && OptimizationEnabled(db, SQLITE_SkipScan)
   && pProbe->aiRowLogEst[saved_nEq+1]>=42  /* TUNING: Minimum for skip-scan */
   && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK
  ){
    LogEst nIter;
    pNew->u.btree.nEq++;
    pNew->nSkip++;