]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix the query planner so that it uses the multi-index OR-clause solution if
authordrh <drh@noemail.net>
Thu, 21 Oct 2010 02:05:06 +0000 (02:05 +0000)
committerdrh <drh@noemail.net>
Thu, 21 Oct 2010 02:05:06 +0000 (02:05 +0000)
that is the lowest cost estimate.  A prior bug cause the multi-index solution
to be ignored in some circumstances.

FossilOrigin-Name: 28ba6255282b1419b8b165e8461018d257b1f6c2

manifest
manifest.uuid
src/where.c

index 1a93e4732982fc3e330c3928a4017828f87aa093..1453abb12e38f0ac5a6808ed84246cfe22edbaa9 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-C Avoid\staking\slocks\son\sunused\sdatabase\sconnections\swhen\scommitting\sa\nread\stransaction.
-D 2010-10-14T01:17:30
+C Fix\sthe\squery\splanner\sso\sthat\sit\suses\sthe\smulti-index\sOR-clause\ssolution\sif\nthat\sis\sthe\slowest\scost\sestimate.\s\sA\sprior\sbug\scause\sthe\smulti-index\ssolution\nto\sbe\signored\sin\ssome\scircumstances.
+D 2010-10-21T02:05:06
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in b01fdfcfecf8a0716c29867a67959f6148b79961
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -240,7 +240,7 @@ F src/vtab.c 6c90e3e65b2f026fc54703a8f3c917155f419d87
 F src/wal.c 0dc7eb9e907a2c280cdcde876d313e07ea4ad811
 F src/wal.h 96669b645e27cd5a111ba59f0cae7743a207bc3c
 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
-F src/where.c 204cdfb66eb82ee17a8fc0a9b12c1ab402755cbb
+F src/where.c 4ca22dea63424d61680021ebdc9248b4f5797666
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
 F test/all.test 6745008c144bd2956d58864d21f7b304689c1cce
@@ -876,14 +876,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P ea8c2f5f8a890dcb422e9e46298ae6ca378c74b7
-R 03d2b3a92f9647a3db71aa9ca75489f4
+P c0ee614fd988f445c4884a37f494479bdd669185
+R 6e8c0a60de16e5bdb6a605bd3f1b39aa
 U drh
-Z c2cdb52e62b9c570a5e1c8427f4ce5c4
+Z b859e44913d29246f2a51ec2ec0453b6
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (GNU/Linux)
 
-iD8DBQFMtlotoxKgR168RlERAuf0AJ96F+hVDOt4y4GU2wooqTHtO4kKZgCeKIVj
-dUPTQwgWJgqAaN5BweGLucY=
-=QYIr
+iD8DBQFMv5/WoxKgR168RlERAgmkAKCN96esWxQzRMXwPF6yb6e9uTWrlQCfYhIV
+wi7V06O0ntyNXUrzsFmI5dw=
+=a2Wv
 -----END PGP SIGNATURE-----
index 4e2a5db00380b32a564cb87c0ffdaf11f92396d3..c178568b65be923c2a1b3485717d3a59e490ab1e 100644 (file)
@@ -1 +1 @@
-c0ee614fd988f445c4884a37f494479bdd669185
\ No newline at end of file
+28ba6255282b1419b8b165e8461018d257b1f6c2
\ No newline at end of file
index 226055b47265e2a15ad687f3288b5058e57f127b..7b3cfce43d1500418c99078055028b489fc2cfd1 100644 (file)
@@ -235,7 +235,7 @@ struct WhereCost {
 #define WHERE_COLUMN_IN    0x00040000  /* x IN (...) */
 #define WHERE_COLUMN_NULL  0x00080000  /* x IS NULL */
 #define WHERE_INDEXED      0x000f0000  /* Anything that uses an index */
-#define WHERE_NOT_FULLSCAN 0x000f3000  /* Does not do a full table scan */
+#define WHERE_NOT_FULLSCAN 0x100f3000  /* Does not do a full table scan */
 #define WHERE_IN_ABLE      0x000f1000  /* Able to support an IN operator */
 #define WHERE_TOP_LIMIT    0x00100000  /* x<EXPR or x<=EXPR constraint */
 #define WHERE_BTM_LIMIT    0x00200000  /* x>EXPR or x>=EXPR constraint */
@@ -1581,8 +1581,9 @@ static void bestOrClauseIndex(
   WhereTerm * const pWCEnd = &pWC->a[pWC->nTerm];        /* End of pWC->a[] */
   WhereTerm *pTerm;                 /* A single term of the WHERE clause */
 
-  /* No OR-clause optimization allowed if the NOT INDEXED clause is used */
-  if( pSrc->notIndexed ){
+  /* No OR-clause optimization allowed if the INDEXED BY or NOT INDEXED clauses
+  ** are used */
+  if( pSrc->notIndexed || pSrc->pIndex!=0 ){
     return;
   }