]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Cherrypicked from trunk: Do not try to use STAT2 for row estimates if the
authordrh <drh@noemail.net>
Wed, 13 Jul 2011 18:53:13 +0000 (18:53 +0000)
committerdrh <drh@noemail.net>
Wed, 13 Jul 2011 18:53:13 +0000 (18:53 +0000)
index is unique or nearly so.

FossilOrigin-Name: d55b64ef7e04e10a31360dea55751a33a0d591a4

manifest
manifest.uuid
src/where.c

index 036cacbc2c0e93da3830a5c472e397de60ae38d0..f72ca6ad6246b1e4f6bc7344e866c5d743779649 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Cherrypick\schange\s[9f14fa56ba]\s(the\sfix\sfor\s[54844eea3f])\sfrom\sthe\strunk.
-D 2011-07-12T14:48:56.574
+C Cherrypicked\sfrom\strunk:\s\sDo\snot\stry\sto\suse\sSTAT2\sfor\srow\sestimates\sif\sthe\nindex\sis\sunique\sor\snearly\sso.
+D 2011-07-13T18:53:13.589
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 543f91f24cd7fee774ecc0a61c19704c0c3e78fd
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -230,7 +230,7 @@ F src/vtab.c 0e8e0cb30dffb078367e843e84e37ef99236c7e4
 F src/wal.c 5ac2119e23ee4424599d4275b66dc88d612a0543
 F src/wal.h 96669b645e27cd5a111ba59f0cae7743a207bc3c
 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
-F src/where.c def5ef535909779f6fe23bde7779ce6256976972
+F src/where.c db40458b67dbd77c658178ec6c53432807759c3f
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
 F test/all.test 6745008c144bd2956d58864d21f7b304689c1cce
@@ -851,7 +851,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 9bbcd8c076ce1add222da1f45ff4ee5ea2fcfc2e
-R a0a01d591a762c7dcc1325c3e75bbb8f
-U dan
-Z 72961d3db50330bb343b511f07c73431
+P 7afb2354d3791cbce00200ddee6d9f230b9452e2
+R 284ce20ede0bb04e29c76d365b6f3d0b
+U drh
+Z 90dfab96918bae66e5af513add83497e
index a88968fed5b62955474b5effcc28d164b842f67d..c101a0787381995c4a60aa80495dce3b6ac95dcb 100644 (file)
@@ -1 +1 @@
-7afb2354d3791cbce00200ddee6d9f230b9452e2
\ No newline at end of file
+d55b64ef7e04e10a31360dea55751a33a0d591a4
\ No newline at end of file
index 50808968ea7d7d703f475e55551779327400a691..00c25a5a1de4154efd4bce5619f91f19dfbb37ee 100644 (file)
@@ -3108,12 +3108,13 @@ static void bestBtreeIndex(
     }
 
 #ifdef SQLITE_ENABLE_STAT2
-    /* If the constraint is of the form x=VALUE and histogram
+    /* If the constraint is of the form x=VALUE or x IN (E1,E2,...)
+    ** and we do not think that values of x are unique and if histogram
     ** data is available for column x, then it might be possible
     ** to get a better estimate on the number of rows based on
     ** VALUE and how common that value is according to the histogram.
     */
-    if( nRow>(double)1 && nEq==1 && pFirstTerm!=0 ){
+    if( nRow>(double)1 && nEq==1 && pFirstTerm!=0 && aiRowEst[1]>1 ){
       if( pFirstTerm->eOperator & (WO_EQ|WO_ISNULL) ){
         testcase( pFirstTerm->eOperator==WO_EQ );
         testcase( pFirstTerm->pOperator==WO_ISNULL );