/ Check-in [171aa833]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Add an EXPLAIN QUERY PLAN line for when a index is used to implement an IN operator.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | rowvalue
Files: files | file ages | folders
SHA1: 171aa833a2e1650c3d9cf9bd6438ae46f6c35871
User & Date: drh 2016-08-26 19:54:12
Context
2016-08-26
21:15
Fix the sqlite3FindInIndex() to ensure that it always uses a prefix of the index and uses no repeated columns. Enhanced comments. check-in: b9fc89e4 user: drh tags: rowvalue
19:54
Add an EXPLAIN QUERY PLAN line for when a index is used to implement an IN operator. check-in: 171aa833 user: drh tags: rowvalue
19:47
Add test cases to rowvalue2.test. check-in: 078bb69e user: dan tags: rowvalue
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  2225   2225             }
  2226   2226             if( j==nExpr ) break;
  2227   2227             if( aiMap ) aiMap[i] = j;
  2228   2228           }
  2229   2229   
  2230   2230           if( i==nExpr ){
  2231   2231             int iAddr = sqlite3CodeOnce(pParse); VdbeCoverage(v);
         2232  +#ifndef SQLITE_OMIT_EXPLAIN
         2233  +          sqlite3VdbeAddOp4(v, OP_Explain, 0, 0, 0,
         2234  +            sqlite3MPrintf(db, "USING INDEX %s FOR IN-OPERATOR", pIdx->zName),
         2235  +            P4_DYNAMIC);
         2236  +#endif
  2232   2237             sqlite3VdbeAddOp3(v, OP_OpenRead, iTab, pIdx->tnum, iDb);
  2233   2238             sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
  2234   2239             VdbeComment((v, "%s", pIdx->zName));
  2235   2240             assert( IN_INDEX_INDEX_DESC == IN_INDEX_INDEX_ASC+1 );
  2236   2241             eType = IN_INDEX_INDEX_ASC + pIdx->aSortOrder[0];
  2237   2242   
  2238   2243             if( prRhsHasNull ){