Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Ensure that the optional "sz=N" parameter that can be manually added to the end of an sqlite_stat1 entry does not have an N value that is too small. Ticket [e4598ecbdd18bd82] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
98357d8c1263920b33a3648ef9214a63 |
User & Date: | drh 2019-08-15 14:35:45 |
Context
2019-08-15
| ||
21:27 | Add the SQLITE_DBCONFIG_ENABLE_VIEW option, together with a "db config" command in the TCL interface that can access that option as well as all the other sqlite3_db_config() boolean options. (check-in: 61b4bccd user: drh tags: trunk) | |
20:04 | Provide the SQLITE_DIRECTONLY flag for app-defined functions that prohibits the use of those functions within triggers or views. (Closed-Leaf check-in: fc745845 user: drh tags: directonly) | |
14:35 | Ensure that the optional "sz=N" parameter that can be manually added to the end of an sqlite_stat1 entry does not have an N value that is too small. Ticket [e4598ecbdd18bd82] (check-in: 98357d8c user: drh tags: trunk) | |
13:53 | Ensure that SQLite does not attempt to process incompatible window functions in a single scan. Fix for [256741a1]. (check-in: 4f5b2d93 user: dan tags: trunk) | |
Changes
Changes to src/analyze.c.
︙ | ︙ | |||
1446 1447 1448 1449 1450 1451 1452 | #endif pIndex->bUnordered = 0; pIndex->noSkipScan = 0; while( z[0] ){ if( sqlite3_strglob("unordered*", z)==0 ){ pIndex->bUnordered = 1; }else if( sqlite3_strglob("sz=[0-9]*", z)==0 ){ | > > | | 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 | #endif pIndex->bUnordered = 0; pIndex->noSkipScan = 0; while( z[0] ){ if( sqlite3_strglob("unordered*", z)==0 ){ pIndex->bUnordered = 1; }else if( sqlite3_strglob("sz=[0-9]*", z)==0 ){ int sz = sqlite3Atoi(z+3); if( sz<2 ) sz = 2; pIndex->szIdxRow = sqlite3LogEst(sz); }else if( sqlite3_strglob("noskipscan*", z)==0 ){ pIndex->noSkipScan = 1; } #ifdef SQLITE_ENABLE_COSTMULT else if( sqlite3_strglob("costmult=[0-9]*",z)==0 ){ pIndex->pTable->costMult = sqlite3LogEst(sqlite3Atoi(z+9)); } |
︙ | ︙ |
Changes to src/where.c.
︙ | ︙ | |||
2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 | } } /* Set rCostIdx to the cost of visiting selected rows in index. Add ** it to pNew->rRun, which is currently set to the cost of the index ** seek only. Then, if this is a non-covering index, add the cost of ** visiting the rows in the main table. */ rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow; pNew->rRun = sqlite3LogEstAdd(rLogSize, rCostIdx); if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK))==0 ){ pNew->rRun = sqlite3LogEstAdd(pNew->rRun, pNew->nOut + 16); } ApplyCostMultiplier(pNew->rRun, pProbe->pTable->costMult); | > | 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 | } } /* Set rCostIdx to the cost of visiting selected rows in index. Add ** it to pNew->rRun, which is currently set to the cost of the index ** seek only. Then, if this is a non-covering index, add the cost of ** visiting the rows in the main table. */ assert( pSrc->pTab->szTabRow>0 ); rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow; pNew->rRun = sqlite3LogEstAdd(rLogSize, rCostIdx); if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK))==0 ){ pNew->rRun = sqlite3LogEstAdd(pNew->rRun, pNew->nOut + 16); } ApplyCostMultiplier(pNew->rRun, pProbe->pTable->costMult); |
︙ | ︙ |
Changes to test/analyzeC.test.
︙ | ︙ | |||
127 128 129 130 131 132 133 134 135 136 137 138 139 140 | ANALYZE sqlite_master; SELECT count(a) FROM t1; } {6} do_execsql_test 4.3 { EXPLAIN QUERY PLAN SELECT count(a) FROM t1; } {/.*INDEX t1ca.*/} # The sz=NNN parameter works even if there is other extraneous text # in the sqlite_stat1.stat column. # do_execsql_test 5.0 { DELETE FROM sqlite_stat1; | > > > > > > > > > > > > > > | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | ANALYZE sqlite_master; SELECT count(a) FROM t1; } {6} do_execsql_test 4.3 { EXPLAIN QUERY PLAN SELECT count(a) FROM t1; } {/.*INDEX t1ca.*/} # 2019-08-15. # Ticket https://www.sqlite.org/src/tktview/e4598ecbdd18bd82945f602901 # The sz=N parameter in the sqlite_stat1 table needs to have a value of # 2 or more to avoid a division by zero in the query planner. # do_execsql_test 4.4 { DROP TABLE IF EXISTS t44; CREATE TABLE t44(a PRIMARY KEY); INSERT INTO sqlite_stat1 VALUES('t44',null,'sz=0'); ANALYZE sqlite_master; SELECT 0 FROM t44 WHERE a IN(1,2,3); } {} # The sz=NNN parameter works even if there is other extraneous text # in the sqlite_stat1.stat column. # do_execsql_test 5.0 { DELETE FROM sqlite_stat1; |
︙ | ︙ |