Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | The query planner fix of check-in [33b1f584ef] should have been on the trunk. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f538d759beda67e042b66181b65bd432 |
User & Date: | drh 2010-04-15 13:29:38.000 |
Context
2010-04-15
| ||
23:24 | Disable query flattening when the outer query is a compound SELECT and the inner query has a LIMIT clause. Ticket [02a8e81d44]. (check-in: f96782b389 user: drh tags: trunk) | |
13:29 | The query planner fix of check-in [33b1f584ef] should have been on the trunk. (check-in: f538d759be user: drh tags: trunk) | |
01:04 | Further refinements to table order selection on join query planning. (check-in: defaf0d99a user: drh tags: trunk) | |
Changes
Changes to src/where.c.
︙ | ︙ | |||
2733 2734 2735 2736 2737 2738 2739 2740 | /* If there are additional constraints on this table that cannot ** be used with the current index, but which might lower the number ** of output rows, adjust the nRow value accordingly. This only ** matters if the current index is the least costly, so do not bother ** with this step if we already know this index will not be chosen. ** Also, never reduce the output row count below 2 using this step. */ | > > > > > > > > > | | | | > > | | 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 | /* If there are additional constraints on this table that cannot ** be used with the current index, but which might lower the number ** of output rows, adjust the nRow value accordingly. This only ** matters if the current index is the least costly, so do not bother ** with this step if we already know this index will not be chosen. ** Also, never reduce the output row count below 2 using this step. ** ** Do not reduce the output row count if pSrc is the only table that ** is notReady; if notReady is a power of two. This will be the case ** when the main sqlite3WhereBegin() loop is scanning for a table with ** and "optimal" index, and on such a scan the output row count ** reduction is not valid because it does not update the "pCost->used" ** bitmap. The notReady bitmap will also be a power of two when we ** are scanning for the last table in a 64-way join. We are willing ** to bypass this optimization in that corner case. */ if( nRow>2 && cost<=pCost->rCost && (notReady & (notReady-1))!=0 ){ int k; /* Loop counter */ int nSkipEq = nEq; /* Number of == constraints to skip */ int nSkipRange = nBound; /* Number of < constraints to skip */ Bitmask thisTab; /* Bitmap for pSrc */ thisTab = getMask(pWC->pMaskSet, iCur); for(pTerm=pWC->a, k=pWC->nTerm; nRow>2 && k; k--, pTerm++){ if( pTerm->wtFlags & TERM_VIRTUAL ) continue; if( (pTerm->prereqAll & notReady)!=thisTab ) continue; if( pTerm->eOperator & (WO_EQ|WO_IN|WO_ISNULL) ){ if( nSkipEq ){ /* Ignore the first nEq equality matches since the index ** has already accounted for these */ |
︙ | ︙ |