/ Check-in [650a3fe0]
Login

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

Overview
Comment:Add a test-control to disable the skip-scan optimization.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 650a3fe03d61068e06f3097878a777ca8ed713a769444cdb3f8be7d1e19a0b83
User & Date: dan 2018-07-12 19:14:39
Context
2018-07-13
19:52
Add the "categories" option to the unicode61 tokenizer in fts5. check-in: 80d2b9e6 user: dan tags: trunk
2018-07-12
19:28
Merge latest trunk changes into this branch. check-in: 6a00a34e user: dan tags: begin-concurrent
19:14
Add a test-control to disable the skip-scan optimization. check-in: 650a3fe0 user: dan tags: trunk
11:28
Add a test case to check that SQLITE_DBCONFIG_RESET_DATABASE can be used with wal mode databases even if there are active readers. check-in: 6145f5b3 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/sqliteInt.h.

  1579   1579   #define SQLITE_OmitNoopJoin   0x0100   /* Omit unused tables in joins */
  1580   1580   #define SQLITE_CountOfView    0x0200   /* The count-of-view optimization */
  1581   1581   #define SQLITE_CursorHints    0x0400   /* Add OP_CursorHint opcodes */
  1582   1582   #define SQLITE_Stat34         0x0800   /* Use STAT3 or STAT4 data */
  1583   1583      /* TH3 expects the Stat34  ^^^^^^ value to be 0x0800.  Don't change it */
  1584   1584   #define SQLITE_PushDown       0x1000   /* The push-down optimization */
  1585   1585   #define SQLITE_SimplifyJoin   0x2000   /* Convert LEFT JOIN to JOIN */
         1586  +#define SQLITE_SkipScan       0x4000   /* Skip-scans */
  1586   1587   #define SQLITE_AllOpts        0xffff   /* All optimizations */
  1587   1588   
  1588   1589   /*
  1589   1590   ** Macros for testing whether or not optimizations are enabled or disabled.
  1590   1591   */
  1591   1592   #define OptimizationDisabled(db, mask)  (((db)->dbOptFlags&(mask))!=0)
  1592   1593   #define OptimizationEnabled(db, mask)   (((db)->dbOptFlags&(mask))==0)

Changes to src/test1.c.

  6950   6950       { "distinct-opt",        SQLITE_DistinctOpt    },
  6951   6951       { "cover-idx-scan",      SQLITE_CoverIdxScan   },
  6952   6952       { "order-by-idx-join",   SQLITE_OrderByIdxJoin },
  6953   6953       { "transitive",          SQLITE_Transitive     },
  6954   6954       { "omit-noop-join",      SQLITE_OmitNoopJoin   },
  6955   6955       { "stat3",               SQLITE_Stat34         },
  6956   6956       { "stat4",               SQLITE_Stat34         },
         6957  +    { "skip-scan",           SQLITE_SkipScan       },
  6957   6958     };
  6958   6959   
  6959   6960     if( objc!=4 ){
  6960   6961       Tcl_WrongNumArgs(interp, 1, objv, "DB OPT BOOLEAN");
  6961   6962       return TCL_ERROR;
  6962   6963     }
  6963   6964     if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;

Changes to src/where.c.

  2668   2668     ** the code). And, even if it is not, it should not be too much slower. 
  2669   2669     ** On the other hand, the extra seeks could end up being significantly
  2670   2670     ** more expensive.  */
  2671   2671     assert( 42==sqlite3LogEst(18) );
  2672   2672     if( saved_nEq==saved_nSkip
  2673   2673      && saved_nEq+1<pProbe->nKeyCol
  2674   2674      && pProbe->noSkipScan==0
         2675  +   && OptimizationEnabled(db, SQLITE_SkipScan)
  2675   2676      && pProbe->aiRowLogEst[saved_nEq+1]>=42  /* TUNING: Minimum for skip-scan */
  2676   2677      && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK
  2677   2678     ){
  2678   2679       LogEst nIter;
  2679   2680       pNew->u.btree.nEq++;
  2680   2681       pNew->nSkip++;
  2681   2682       pNew->aLTerm[pNew->nLTerm++] = 0;

Changes to test/skipscan1.test.

   333    333     ANALYZE sqlite_master;
   334    334     INSERT INTO sqlite_stat1 VALUES('t9a','t9a_ab','1000000 250000 1');
   335    335     ANALYZE sqlite_master;
   336    336     EXPLAIN QUERY PLAN
   337    337     SELECT * FROM t9a WHERE b IN (SELECT x FROM t9b WHERE y!=5);
   338    338   } {/USING INDEX t9a_ab .ANY.a. AND b=./}
   339    339   
          340  +
          341  +optimization_control db skip-scan 0
          342  +do_execsql_test skipscan1-9.3 {
          343  +  EXPLAIN QUERY PLAN
          344  +  SELECT  * FROM t9a WHERE b IN (SELECT x FROM t9b WHERE y!=5);
          345  +} {/{SCAN TABLE t9a}/}
          346  +optimization_control db skip-scan 1
          347  +
   340    348   finish_test