-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-C Bring\sover\sthe\srecent\squery\splanner\senhancements\sfrom\sthe\strunk.
-D 2010-04-15T02:37:11
+C Fix\sa\sproblem\sin\sthe\sresult\sset\ssize\sestimation\slogic\sof\sthe\squery\splanner\s-\s\na\sproblem\sintroduced\sby\sthe\stwo\sprevious\schanges.
+D 2010-04-15T12:36:07
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
-F src/where.c 74ff6f0d96b3190f8abe2ceaa09858441749e8ff
+F src/where.c faadd9c2bf08868e5135192b44e0d753e363a885
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P c18077f2465fc34830f11c9832e76be5746eaeea defaf0d99a807027f8883bf821b6482025f9f54e
-R 5f5abc6d19fbeba7fb34263a5662faa7
+P 82969f27e5ea843cb379666d8a02e4a3fddc03b2
+R 351077133ab404e2e491a33b905acb9d
U drh
-Z 9dfe9b346dd22ca03d0d17a2ddbb8a3c
+Z 2a5a2f50be97ee24579935014cd533e4
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
-iD8DBQFLxnvaoxKgR168RlERAkpHAJ9umCCf7Sfy2xa1T3mJ1bqzrPY7tgCgjEA2
-oN5S7m+hWn0GMbvXKOIs1cY=
-=ADT1
+iD8DBQFLxwg6oxKgR168RlERAn1aAJ96LitidK5axyWqFd8S2OYRbsKviACdE9xg
+/OWvfn581zFJtn2LS8VJjjA=
+=qS5Y
-----END PGP SIGNATURE-----
** 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 ){
- int k;
- int nSkipEq = nEq;
- int nSkipRange = nBound;
- Bitmask thisTab = getMask(pWC->pMaskSet, iCur);
+ 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;