Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix some problems with the LIKE optimization. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | nextgen-query-planner |
Files: | files | file ages | folders |
SHA1: |
8330a468316650ff02f2bd71be5861d1 |
User & Date: | dan 2013-07-18 19:53:06 |
Context
2013-07-19
| ||
18:33 | Fix some problems to do with optimizing ORDER BY queries. check-in: cc7bc86da5 user: dan tags: nextgen-query-planner | |
2013-07-18
| ||
19:53 | Fix some problems with the LIKE optimization. check-in: 8330a46831 user: dan tags: nextgen-query-planner | |
2013-07-17
| ||
20:03 | Fix a bug preventing the planner from finding sorting indexes. check-in: 6f06ebee56 user: dan tags: nextgen-query-planner | |
Changes
Changes to src/where.c.
1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 |
c = sqlite4UpperToLower[c]; } *pC = c + 1; } sCollSeqName.z = noCase ? "NOCASE" : "BINARY"; sCollSeqName.n = 6; pNewExpr1 = sqlite4ExprDup(db, pLeft, 0); pNewExpr1 = sqlite4PExpr(pParse, TK_GE, sqlite4ExprAddCollateToken(pParse,pNewExpr1,&sCollSeqName), pStr1, 0); idxNew1 = whereClauseInsert(pWC, pNewExpr1, TERM_VIRTUAL|TERM_DYNAMIC); testcase( idxNew1==0 ); exprAnalyze(pSrc, pWC, idxNew1); pNewExpr2 = sqlite4ExprDup(db, pLeft, 0); pNewExpr2 = sqlite4PExpr(pParse, TK_LT, sqlite4ExprAddCollateToken(pParse,pNewExpr2,&sCollSeqName), pStr2, 0); idxNew2 = whereClauseInsert(pWC, pNewExpr2, TERM_VIRTUAL|TERM_DYNAMIC); testcase( idxNew2==0 ); exprAnalyze(pSrc, pWC, idxNew2); pTerm = &pWC->a[idxTerm]; if( isComplete ){ pWC->a[idxNew1].iParent = idxTerm; pWC->a[idxNew2].iParent = idxTerm; |
| | < | | < |
1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 |
c = sqlite4UpperToLower[c]; } *pC = c + 1; } sCollSeqName.z = noCase ? "NOCASE" : "BINARY"; sCollSeqName.n = 6; pNewExpr1 = sqlite4ExprDup(db, pLeft, 0); pNewExpr1 = sqlite4PExpr(pParse, TK_GE, pNewExpr1, pStr1, 0); sqlite4ExprSetCollByToken(pParse, pNewExpr1, &sCollSeqName); idxNew1 = whereClauseInsert(pWC, pNewExpr1, TERM_VIRTUAL|TERM_DYNAMIC); testcase( idxNew1==0 ); exprAnalyze(pSrc, pWC, idxNew1); pNewExpr2 = sqlite4ExprDup(db, pLeft, 0); pNewExpr2 = sqlite4PExpr(pParse, TK_LT, pNewExpr2, pStr2, 0); sqlite4ExprSetCollByToken(pParse, pNewExpr2, &sCollSeqName); idxNew2 = whereClauseInsert(pWC, pNewExpr2, TERM_VIRTUAL|TERM_DYNAMIC); testcase( idxNew2==0 ); exprAnalyze(pSrc, pWC, idxNew2); pTerm = &pWC->a[idxTerm]; if( isComplete ){ pWC->a[idxNew1].iParent = idxTerm; pWC->a[idxNew2].iParent = idxTerm; |
Changes to test/where8.test.
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
...
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
# The "OR c = 'IX'" term forces a linear scan. execsql_status2 { SELECT a, d FROM t1, t2 WHERE (a = 2 OR b = 'three' OR c = 'IX') AND (d = a OR e = 'sixteen') ORDER BY t1.rowid } } {2 2 2 4 3 3 3 4 9 9 9 4 0 0 seek=13 step=16} do_test where8-3.10 { execsql_status { SELECT d FROM t2 WHERE e IS NULL OR e = 'four' } } {1 3 5 10 2 0 0} do_test where8-3.11 { ................................................................................ SELECT a, d FROM t1, t2 WHERE (a=d OR b=e) AND a<5 ORDER BY a } } {1 1 2 2 3 3 4 2 4 4 0 0} do_test where8-3.12 { execsql_status { SELECT a, d FROM t1, t2 WHERE (a=d OR b=e) AND +a<5 ORDER BY a } } {1 1 2 2 3 3 4 2 4 4 0 0} do_test where8-3.13 { execsql_status { SELECT a, d FROM t1, t2 WHERE (a=d OR b=e) AND +a<5 } } {1 1 2 2 3 3 4 2 4 4 9 0} do_test where8-3.14 { |
|
|
|
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
...
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
# The "OR c = 'IX'" term forces a linear scan. execsql_status2 { SELECT a, d FROM t1, t2 WHERE (a = 2 OR b = 'three' OR c = 'IX') AND (d = a OR e = 'sixteen') ORDER BY t1.rowid } } {2 2 2 4 3 3 3 4 9 9 9 4 9 0 seek=13 step=16} do_test where8-3.10 { execsql_status { SELECT d FROM t2 WHERE e IS NULL OR e = 'four' } } {1 3 5 10 2 0 0} do_test where8-3.11 { ................................................................................ SELECT a, d FROM t1, t2 WHERE (a=d OR b=e) AND a<5 ORDER BY a } } {1 1 2 2 3 3 4 2 4 4 0 0} do_test where8-3.12 { execsql_status { SELECT a, d FROM t1, t2 WHERE (a=d OR b=e) AND +a<5 ORDER BY a } } {1 1 2 2 3 3 4 2 4 4 9 0} do_test where8-3.13 { execsql_status { SELECT a, d FROM t1, t2 WHERE (a=d OR b=e) AND +a<5 } } {1 1 2 2 3 3 4 2 4 4 9 0} do_test where8-3.14 { |