From: dan Date: Sat, 2 Jul 2011 15:42:12 +0000 (+0000) Subject: Cherrypick change [27c65d4d9c] into the 3.7.2 branch. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8e3b3330800660fc720cbe834ddd557a7c051b80;p=thirdparty%2Fsqlite.git Cherrypick change [27c65d4d9c] into the 3.7.2 branch. FossilOrigin-Name: 9bbcd8c076ce1add222da1f45ff4ee5ea2fcfc2e --- diff --git a/manifest b/manifest index 7e46f3a08a..b00599ac45 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Cherrypick\s[45e581bff7]\sinto\sthe\s3.7.2\sbranch. -D 2011-07-02T13:34:15.849 +C Cherrypick\schange\s[27c65d4d9c]\sinto\sthe\s3.7.2\sbranch. +D 2011-07-02T15:42:12.533 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 ecdf9bfa72cc2b6dade7770abebd0f58520dc4c3 +F src/where.c f4561d5258681f94b663d81fe76f03ef6a524f0a F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 6745008c144bd2956d58864d21f7b304689c1cce @@ -257,7 +257,7 @@ F test/auth.test 26cc6f219580191539bf335abe03e55e49310846 F test/auth2.test 270baddc8b9c273682760cffba6739d907bd2882 F test/auth3.test a4755e6a2a2fea547ffe63c874eb569e60a28eb5 F test/autoinc.test 85ef3180a737e6580086a018c09c6f1a52759b46 -F test/autoindex1.test fb1fe6a000ed0b3c2a4101cc4884313c3661e68e +F test/autoindex1.test 5832aabf500dada692f325251a2231ab6b0e2d9a F test/autovacuum.test bb7c0885e6f8f1d633045de48f2b66082162766d F test/autovacuum_ioerr2.test 598b0663074d3673a9c1bc9a16e80971313bafe6 F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85 @@ -850,7 +850,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 7155e6f3282671487f262fd51a7cb139dffdbde6 -R 6e0436030204a21a4eb3844cebd2fc86 +P c593792ce00d0a6379f31cab1bca22f5e159ce18 +R 4d654992cb4816a2a8066724f218a1f3 U dan -Z 721893e46221c159c6e716d0c7bd616b +Z 449cb15ff909d159c8f79196788b498c diff --git a/manifest.uuid b/manifest.uuid index e5f7c63763..9bb06ac8f1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c593792ce00d0a6379f31cab1bca22f5e159ce18 \ No newline at end of file +9bbcd8c076ce1add222da1f45ff4ee5ea2fcfc2e \ No newline at end of file diff --git a/src/where.c b/src/where.c index ad6b6dd779..238f82203d 100644 --- a/src/where.c +++ b/src/where.c @@ -1903,6 +1903,10 @@ static void bestAutomaticIndex( WhereTerm *pWCEnd; /* End of pWC->a[] */ Table *pTable; /* Table tht might be indexed */ + if( pParse->nQueryLoop<=(double)1 ){ + /* There is no point in building an automatic index for a single scan */ + return; + } if( (pParse->db->flags & SQLITE_AutoIndex)==0 ){ /* Automatic indices are disabled at run-time */ return; diff --git a/test/autoindex1.test b/test/autoindex1.test index 7ffd644552..cee013b10a 100644 --- a/test/autoindex1.test +++ b/test/autoindex1.test @@ -165,4 +165,13 @@ do_test autoindex1-502 { } } {0 0 0 {SEARCH TABLE t501 USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)} 0 0 0 {SCAN TABLE t502 (~100000 rows)}} + +do_execsql_test autoindex1-700 { + CREATE TABLE t5(a, b, c); + EXPLAIN QUERY PLAN SELECT a FROM t5 WHERE b=10 ORDER BY c; +} { + 0 0 0 {SCAN TABLE t5 (~100000 rows)} +} + + finish_test