]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Small tweaks to the query planner to get it to try harder to use an index branch-3.8.3
authordrh <drh@noemail.net>
Tue, 17 Jun 2014 15:13:04 +0000 (15:13 +0000)
committerdrh <drh@noemail.net>
Tue, 17 Jun 2014 15:13:04 +0000 (15:13 +0000)
for sorting and to avoid using automatic indexes on constant terms.

FossilOrigin-Name: 2d9de154f8f398d66693a4bc35eef1353ae61728

manifest
manifest.uuid
src/where.c

index 8b72fa3c7f821dff0224be8c828dccb833001c93..b1885fd82f6cf98d9164fa9b22f38195cc034813 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Version\s3.8.3.1
-D 2014-02-11T14:52:19.939
+C Small\stweaks\sto\sthe\squery\splanner\sto\sget\sit\sto\stry\sharder\sto\suse\san\sindex\nfor\ssorting\sand\sto\savoid\susing\sautomatic\sindexes\son\sconstant\sterms.
+D 2014-06-17T15:13:04.717
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
 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 11edb74d587bc87b33ca96a5173e3ec1b8389e45
-F src/where.c 540f52385a653d7cc077e381875ec02bf4c80053
+F src/where.c 9ec7ce024a5963a3c0b3f3234fbef5de53f08f54
 F src/whereInt.h 96a75c61f1d2b9d4a8e4bb17d89deb0cf7cba358
 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
@@ -1153,10 +1153,7 @@ F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 3111df71b2a6bef08cf37c6e350f5accc506f9eb
-R bed1bf07eba8673ccef2bc493f925e43
-T +bgcolor * #d0c0ff
-T +sym-release *
-T +sym-version-3.8.3.1 *
+P ea3317a4803d71d88183b29f1d3086f46d68a00e
+R f3e3efe64172b5c947d66b04e17d9c81
 U drh
-Z ae0c2dc014fac62d82a18ce766a4d589
+Z ab6ad47f6438e43e215e120c654c4cf3
index cfdba17d018e6f6b272927b5f65301b32635873a..0a416ca410d6519cc48ae2eb0f3f99d6a6421d72 100644 (file)
@@ -1 +1 @@
-ea3317a4803d71d88183b29f1d3086f46d68a00e
\ No newline at end of file
+2d9de154f8f398d66693a4bc35eef1353ae61728
\ No newline at end of file
index 67ef577e9b560b118039cb0f0fc7ef30aab2a5d4..704890ca3f6fd18f7bcfdba7881c6d9964f77142 100644 (file)
@@ -4213,6 +4213,7 @@ static int whereLoopAddBtree(
     WhereTerm *pWCEnd = pWC->a + pWC->nTerm;
     for(pTerm=pWC->a; rc==SQLITE_OK && pTerm<pWCEnd; pTerm++){
       if( pTerm->prereqRight & pNew->maskSelf ) continue;
+      if( sqlite3ExprIsConstant(pTerm->pExpr->pRight) ) continue;
       if( termCanDriveIndex(pTerm, pSrc, 0) ){
         pNew->u.btree.nEq = 1;
         pNew->u.btree.nSkip = 0;
@@ -4972,7 +4973,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
     ** number of output rows. The 48 is the expected size of a row to sort. 
     ** FIXME:  compute a better estimate of the 48 multiplier based on the
     ** result set expressions. */
-    rSortCost = nRowEst + estLog(nRowEst);
+    rSortCost = nRowEst + estLog(nRowEst) + 10;
     WHERETRACE(0x002,("---- sort cost=%-3d\n", rSortCost));
   }