From: drh Date: Mon, 18 Nov 2013 19:32:15 +0000 (+0000) Subject: Add comments identifing where the skip-scan option is decided in the X-Git-Tag: version-3.8.2~77 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=64ff26f74166ee88c2d94cab965741a70f87468b;p=thirdparty%2Fsqlite.git Add comments identifing where the skip-scan option is decided in the query planner, to aid in tuning that decision. No changes to code. FossilOrigin-Name: e9df04cec48bb8b4ea26ec9024a22ea42b2338eb --- diff --git a/manifest b/manifest index ec98f2b851..5015b49889 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sdocumentation\stypos.\s\sNo\schanges\sto\scode. -D 2013-11-18T18:48:50.010 +C Add\scomments\sidentifing\swhere\sthe\sskip-scan\soption\sis\sdecided\sin\sthe\nquery\splanner,\sto\said\sin\stuning\sthat\sdecision.\s\sNo\schanges\sto\scode. +D 2013-11-18T19:32:15.750 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 8a07bebafbfda0eb67728f4bd15a36201662d1a1 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -293,7 +293,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 7dc3966ef98b74422267e7e6e46e07ff6c6eb1b4 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c e9e593d5bb798c3e67fc3893dfe7055c9e7d8d74 -F src/where.c de64e326bb2a07e5591900b11a93d743df2a6919 +F src/where.c c0a9bab3e783ecab6add9d08430dd5414810f2fe F src/whereInt.h 96a75c61f1d2b9d4a8e4bb17d89deb0cf7cba358 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1140,7 +1140,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 8d002740bffca2a76d2dfbc1a67293d34f9de9ba -R d98b977ab05ba38a226703beb7c26537 +P 7caeb09c52bde4649b02b339f611c8e30f6d1c68 +R 05f4e654e5dee11a1ac27e9ef3c549a9 U drh -Z c53e0578e3a1f9608c085ee4cd6a5e4a +Z b6f4e67d2e374e89823b36eebb6a35ba diff --git a/manifest.uuid b/manifest.uuid index 5126360f83..8f6426f507 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7caeb09c52bde4649b02b339f611c8e30f6d1c68 \ No newline at end of file +e9df04cec48bb8b4ea26ec9024a22ea42b2338eb \ No newline at end of file diff --git a/src/where.c b/src/where.c index ba6e5e0c46..a163895bb7 100644 --- a/src/where.c +++ b/src/where.c @@ -3918,10 +3918,15 @@ static int whereLoopAddBtreeIndex( saved_nOut = pNew->nOut; pNew->rSetup = 0; rLogSize = estLog(sqlite3LogEst(pProbe->aiRowEst[0])); + + /* Consider using a skip-scan if there are no WHERE clause constraints + ** available for the left-most terms of the index, and if the average + ** number of repeats in the left-most terms is at least 50. + */ if( pTerm==0 && saved_nEq==saved_nSkip && saved_nEq+1nKeyCol - && pProbe->aiRowEst[saved_nEq+1]>50 + && pProbe->aiRowEst[saved_nEq+1]>50 /* TUNING: Minimum for skip-scan */ ){ LogEst nIter; pNew->u.btree.nEq++;