Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | When analyzing the right-hand side of IN operators to see if the IN operator can work with an index, be sure to decend into nested subqueries. Fix for ticket [1a1308d2538d7] |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0156f10e23daca0e2504cd293a67ed02 |
User & Date: | drh 2011-09-16 17:43:06.835 |
Context
2011-09-16
| ||
19:04 | Remove unreachable branches from the previous change. Add additional test cases. (check-in: cf51ef8ab8 user: drh tags: trunk) | |
17:43 | When analyzing the right-hand side of IN operators to see if the IN operator can work with an index, be sure to decend into nested subqueries. Fix for ticket [1a1308d2538d7] (check-in: 0156f10e23 user: drh tags: trunk) | |
16:00 | Further streamlining of the subquery materializer. New test cases for ticket [002caede898a] (check-in: ff8b76b25b user: drh tags: trunk) | |
Changes
Changes to src/where.c.
︙ | ︙ | |||
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | } } return mask; } static Bitmask exprSelectTableUsage(WhereMaskSet *pMaskSet, Select *pS){ Bitmask mask = 0; while( pS ){ mask |= exprListTableUsage(pMaskSet, pS->pEList); mask |= exprListTableUsage(pMaskSet, pS->pGroupBy); mask |= exprListTableUsage(pMaskSet, pS->pOrderBy); mask |= exprTableUsage(pMaskSet, pS->pWhere); mask |= exprTableUsage(pMaskSet, pS->pHaving); pS = pS->pPrior; } return mask; } /* ** Return TRUE if the given operator is one of the operators that is | > > > > > > > > | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | } } return mask; } static Bitmask exprSelectTableUsage(WhereMaskSet *pMaskSet, Select *pS){ Bitmask mask = 0; while( pS ){ SrcList *pSrc; mask |= exprListTableUsage(pMaskSet, pS->pEList); mask |= exprListTableUsage(pMaskSet, pS->pGroupBy); mask |= exprListTableUsage(pMaskSet, pS->pOrderBy); mask |= exprTableUsage(pMaskSet, pS->pWhere); mask |= exprTableUsage(pMaskSet, pS->pHaving); if( (pSrc = pS->pSrc)!=0 ){ int i; for(i=0; i<pSrc->nSrc; i++){ mask |= exprSelectTableUsage(pMaskSet, pSrc->a[i].pSelect); mask |= exprTableUsage(pMaskSet, pSrc->a[i].pOn); } } pS = pS->pPrior; } return mask; } /* ** Return TRUE if the given operator is one of the operators that is |
︙ | ︙ |
Changes to test/tkt-31338dca7e.test.
︙ | ︙ | |||
158 159 160 161 162 163 164 165 166 | WHERE (a=1 AND h=4) OR (b IN ( SELECT x+a FROM (SELECT e+f AS x, e FROM t2 ORDER BY 1 LIMIT 2) GROUP BY e )); } } {4 2 4 3 4 {} 4 99 101 3 4 {}} finish_test | > > > > > > > > > > > > | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | WHERE (a=1 AND h=4) OR (b IN ( SELECT x+a FROM (SELECT e+f AS x, e FROM t2 ORDER BY 1 LIMIT 2) GROUP BY e )); } } {4 2 4 3 4 {} 4 99 101 3 4 {}} do_test tkt-31338-3.7 { db eval { SELECT * FROM t3 LEFT JOIN t1 ON d=g LEFT JOIN t4 ON c=h WHERE (a=1 AND h=4) OR (b IN ( SELECT x FROM (SELECT e+f+a AS x, e FROM t2 ORDER BY 1 LIMIT 2) GROUP BY e )); } } {4 2 4 3 4 {} 4 99 101 3 4 {}} finish_test |