Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Adjustments to the cost computation for the skip-scan query plan, to take into account the fact that a seek has to occur on each skip. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0769eebd028ce31375cf93509a1d3687 |
User & Date: | drh 2014-03-10 20:12:31.746 |
Context
2014-03-11
| ||
09:19 | Add a test to see what happens if an rtree constructor encounters an SQLITE_BUSY error. No changes to code. (check-in: 5527e23636 user: dan tags: trunk) | |
01:48 | Version 3.8.4 for sessions (plus two minor fixes). (check-in: 917c410808 user: drh tags: sessions) | |
2014-03-10
| ||
20:12 | Adjustments to the cost computation for the skip-scan query plan, to take into account the fact that a seek has to occur on each skip. (check-in: 0769eebd02 user: drh tags: trunk) | |
18:03 | Attempt to work around MSVC's treatment of __LINE__ as a non-constant value in "Edit and Continue" mode by avoiding the use of __LINE__ when SQLITE_VDBE_COVERAGE is not defined. (check-in: 0a5318bc27 user: drh tags: trunk) | |
Changes
Changes to src/where.c.
︙ | ︙ | |||
3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 | ){ LogEst nIter; pNew->u.btree.nEq++; pNew->u.btree.nSkip++; pNew->aLTerm[pNew->nLTerm++] = 0; pNew->wsFlags |= WHERE_SKIPSCAN; nIter = sqlite3LogEst(pProbe->aiRowEst[0]/pProbe->aiRowEst[saved_nEq+1]); whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter); } for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){ int nIn = 0; #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 int nRecValid = pBuilder->nRecValid; #endif if( (pTerm->eOperator==WO_ISNULL || (pTerm->wtFlags&TERM_VNULL)!=0) | > > > | 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 | ){ LogEst nIter; pNew->u.btree.nEq++; pNew->u.btree.nSkip++; pNew->aLTerm[pNew->nLTerm++] = 0; pNew->wsFlags |= WHERE_SKIPSCAN; nIter = sqlite3LogEst(pProbe->aiRowEst[0]/pProbe->aiRowEst[saved_nEq+1]); pNew->rRun = rLogSize + nIter; pNew->nOut += nIter; whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter); pNew->nOut = saved_nOut; } for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){ int nIn = 0; #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 int nRecValid = pBuilder->nRecValid; #endif if( (pTerm->eOperator==WO_ISNULL || (pTerm->wtFlags&TERM_VNULL)!=0) |
︙ | ︙ |
Changes to test/skipscan1.test.
︙ | ︙ | |||
204 205 206 207 208 209 210 211 212 | SELECT i FROM t4 WHERE c=3; SELECT i FROM t4 WHERE d=4; SELECT i FROM t4 WHERE e=5; SELECT i FROM t4 WHERE f=6; SELECT i FROM t4 WHERE g=7; SELECT i FROM t4 WHERE h=8; } {9 9 9 9 9 9 9 9} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | SELECT i FROM t4 WHERE c=3; SELECT i FROM t4 WHERE d=4; SELECT i FROM t4 WHERE e=5; SELECT i FROM t4 WHERE f=6; SELECT i FROM t4 WHERE g=7; SELECT i FROM t4 WHERE h=8; } {9 9 9 9 9 9 9 9} # Make sure skip-scan cost computation in the query planner takes into # account the fact that the seek must occur multiple times. # # Prior to 2014-03-10, the costs were computed incorrectly which would # cause index t5i2 to be used instead of t5i1 on the skipscan1-5.3. # do_execsql_test skipscan1-5.1 { CREATE TABLE t5( id INTEGER PRIMARY KEY, loc TEXT, lang INTEGER, utype INTEGER, xa INTEGER, xd INTEGER, xh INTEGER ); CREATE INDEX t5i1 on t5(loc, xh, xa, utype, lang); CREATE INDEX t5i2 ON t5(xd,loc,utype,lang); EXPLAIN QUERY PLAN SELECT xh, loc FROM t5 WHERE loc >= 'M' AND loc < 'N'; } {/.*COVERING INDEX t5i1 .*/} do_execsql_test skipscan1-5.2 { ANALYZE; DELETE FROM sqlite_stat1; DROP TABLE IF EXISTS sqlite_stat4; DROP TABLE IF EXISTS sqlite_stat3; INSERT INTO sqlite_stat1 VALUES('t5','t5i1','2702931 3 2 2 2 2'); INSERT INTO sqlite_stat1 VALUES('t5','t5i2','2702931 686 2 2 2'); ANALYZE sqlite_master; } {} db cache flush do_execsql_test skipscan1-5.3 { EXPLAIN QUERY PLAN SELECT xh, loc FROM t5 WHERE loc >= 'M' AND loc < 'N'; } {/.*COVERING INDEX t5i1 .*/} finish_test |