-C Expire\sprepared\sstatements\safter\srunning\sANALYZE.
-D 2014-07-22T14:42:16.806
+C Enhance\sthe\ssqlite_stat1.stat\sparsing\sto\sallow\sadditional\stext\sparameters\nat\sthe\send.\s\sUnrecognized\sparameters\sare\ssilently\signored.
+D 2014-07-22T14:58:12.596
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F sqlite3.1 3d8b83c91651f53472ca17599dae3457b8b89494
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
F src/alter.c b00900877f766f116f9e16116f1ccacdc21d82f1
-F src/analyze.c 9f4e473c83a582d696ce57dc8cb7a40ad1314d02
+F src/analyze.c 56799121c72753f40d56f3c17c66c3961af6acb7
F src/attach.c 3801129015ef59d76bf23c95ef9b0069d18a0c52
F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
F src/backup.c a729e63cf5cd1829507cb7b8e89f99b95141bb53
F src/utf.c a0314e637768a030e6e84a957d0c4f6ba910cc05
F src/util.c 049fe1d3c0e2209c1bee107aec2fcff6285f909f
F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179
-F src/vdbe.c 514adcc9478e461d01b9b064565d2c99604ed537
+F src/vdbe.c 2f3f0582dfacce292d3d6f22d129fe1abe3ddd00
F src/vdbe.h c63fad052c9e7388d551e556e119c0bcf6bebdf8
F src/vdbeInt.h 5df5e9afe9b7839cd17256220fc4f7af84b8b1cd
F src/vdbeapi.c 24e40422382beb774daab11fe9fe9d37e8a04949
F test/analyze6.test f1c552ce39cca4ec922a7e4e0e5d0203d6b3281f
F test/analyze7.test bb1409afc9e8629e414387ef048b8e0e3e0bdc4f
F test/analyze8.test 093d15c1c888eed5034304a98c992f7360130b88
-F test/analyze9.test bd5aaf2a8fd2dd774b08251416897185531a8adf
+F test/analyze9.test 3ef1b471247308e710a794b6e50a6ab536c5604b
F test/analyzeA.test 1a5c40079894847976d983ca39c707aaa44b6944
F test/analyzeB.test 8bf35ee0a548aea831bf56762cb8e7fdb1db083d
+F test/analyzeC.test 555a6cc388b9818b6eda6df816f01ce0a75d3a93
F test/async.test 1d0e056ba1bb9729283a0f22718d3a25e82c277b
F test/async2.test c0a9bd20816d7d6a2ceca7b8c03d3d69c28ffb8b
F test/async3.test d73a062002376d7edc1fe3edff493edbec1fc2f7
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P b22dd165da227a52d88b17a91e80a1701dce61ad
-R 9fe107c1276b2eda80832b2d6848bc6f
+P b083a961f8ac3a6158e822574d73cd63e3103b09
+R 5b14cb35846d5c4a5d2461874ff76990
U drh
-Z 54d8743399e09513763a4a3a09f86610
+Z 267c7ac0e4de2238ef8d9515f94ccafd
--- /dev/null
+# 2014-07-22
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+# This file contains automated tests used to verify that the text terms
+# at the end of sqlite_stat1.stat are processed correctly.
+#
+# (1) "unordered" means that the index cannot be used for ORDER BY
+# or for range queries
+#
+# (2) "sz=NNN" sets the relative size of the index entries
+#
+# (3) All other fields are silently ignored
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix analyzeC
+
+# Baseline case. Range queries work OK. Indexes can be used for
+# ORDER BY.
+#
+do_execsql_test 1.0 {
+ CREATE TABLE t1(a,b,c);
+ INSERT INTO t1(a,b,c)
+ VALUES(1,2,3),(7,8,9),(4,5,6),(10,11,12),(4,8,12),(1,11,111);
+ CREATE INDEX t1a ON t1(a);
+ CREATE INDEX t1b ON t1(b);
+ ANALYZE;
+ DELETE FROM sqlite_stat1;
+ INSERT INTO sqlite_stat1(tbl,idx,stat)
+ VALUES('t1','t1a','12345 2'),('t1','t1b','12345 4');
+ ANALYZE sqlite_master;
+ SELECT *, '#' FROM t1 WHERE a BETWEEN 3 AND 8 ORDER BY c;
+} {4 5 6 # 7 8 9 # 4 8 12 #}
+do_execsql_test 1.1 {
+ EXPLAIN QUERY PLAN
+ SELECT *, '#' FROM t1 WHERE a BETWEEN 3 AND 8 ORDER BY c;
+} {/.* USING INDEX t1a .a>. AND a<...*/}
+do_execsql_test 1.2 {
+ SELECT c FROM t1 ORDER BY a;
+} {3 111 6 12 9 12}
+do_execsql_test 1.3 {
+ EXPLAIN QUERY PLAN
+ SELECT c FROM t1 ORDER BY a;
+} {/.*SCAN TABLE t1 USING INDEX t1a.*/}
+do_execsql_test 1.3x {
+ EXPLAIN QUERY PLAN
+ SELECT c FROM t1 ORDER BY a;
+} {~/.*B-TREE FOR ORDER BY.*/}
+
+# Now mark the t1a index as "unordered". Range queries and ORDER BY no
+# longer use the index, but equality queries do.
+#
+do_execsql_test 2.0 {
+ UPDATE sqlite_stat1 SET stat='12345 2 unordered' WHERE idx='t1a';
+ ANALYZE sqlite_master;
+ SELECT *, '#' FROM t1 WHERE a BETWEEN 3 AND 8 ORDER BY c;
+} {4 5 6 # 7 8 9 # 4 8 12 #}
+do_execsql_test 2.1 {
+ EXPLAIN QUERY PLAN
+ SELECT *, '#' FROM t1 WHERE a BETWEEN 3 AND 8 ORDER BY c;
+} {~/.*USING INDEX.*/}
+do_execsql_test 2.2 {
+ SELECT c FROM t1 ORDER BY a;
+} {3 111 6 12 9 12}
+do_execsql_test 2.3 {
+ EXPLAIN QUERY PLAN
+ SELECT c FROM t1 ORDER BY a;
+} {~/.*USING INDEX.*/}
+do_execsql_test 2.3x {
+ EXPLAIN QUERY PLAN
+ SELECT c FROM t1 ORDER BY a;
+} {/.*B-TREE FOR ORDER BY.*/}
+
+# Ignore extraneous text parameters in the sqlite_stat1.stat field.
+#
+do_execsql_test 3.0 {
+ UPDATE sqlite_stat1 SET stat='12345 2 whatever=5 unordered xyzzy=11'
+ WHERE idx='t1a';
+ ANALYZE sqlite_master;
+ SELECT *, '#' FROM t1 WHERE a BETWEEN 3 AND 8 ORDER BY c;
+} {4 5 6 # 7 8 9 # 4 8 12 #}
+do_execsql_test 3.1 {
+ EXPLAIN QUERY PLAN
+ SELECT *, '#' FROM t1 WHERE a BETWEEN 3 AND 8 ORDER BY c;
+} {~/.*USING INDEX.*/}
+do_execsql_test 3.2 {
+ SELECT c FROM t1 ORDER BY a;
+} {3 111 6 12 9 12}
+do_execsql_test 3.3 {
+ EXPLAIN QUERY PLAN
+ SELECT c FROM t1 ORDER BY a;
+} {~/.*USING INDEX.*/}
+do_execsql_test 3.3x {
+ EXPLAIN QUERY PLAN
+ SELECT c FROM t1 ORDER BY a;
+} {/.*B-TREE FOR ORDER BY.*/}
+
+# The sz=NNN parameter determines which index to scan
+#
+do_execsql_test 4.0 {
+ DROP INDEX t1a;
+ CREATE INDEX t1ab ON t1(a,b);
+ CREATE INDEX t1ca ON t1(c,a);
+ DELETE FROM sqlite_stat1;
+ INSERT INTO sqlite_stat1(tbl,idx,stat)
+ VALUES('t1','t1ab','12345 3 2 sz=10'),('t1','t1ca','12345 3 2 sz=20');
+ ANALYZE sqlite_master;
+ SELECT count(a) FROM t1;
+} {6}
+do_execsql_test 4.1 {
+ EXPLAIN QUERY PLAN
+ SELECT count(a) FROM t1;
+} {/.*INDEX t1ab.*/}
+do_execsql_test 4.2 {
+ DELETE FROM sqlite_stat1;
+ INSERT INTO sqlite_stat1(tbl,idx,stat)
+ VALUES('t1','t1ab','12345 3 2 sz=20'),('t1','t1ca','12345 3 2 sz=10');
+ ANALYZE sqlite_master;
+ SELECT count(a) FROM t1;
+} {6}
+do_execsql_test 4.3 {
+ EXPLAIN QUERY PLAN
+ SELECT count(a) FROM t1;
+} {/.*INDEX t1ca.*/}
+
+
+# The sz=NNN parameter works even if there is other extraneous text
+# in the sqlite_stat1.stat column.
+#
+do_execsql_test 5.0 {
+ DELETE FROM sqlite_stat1;
+ INSERT INTO sqlite_stat1(tbl,idx,stat)
+ VALUES('t1','t1ab','12345 3 2 x=5 sz=10 y=10'),
+ ('t1','t1ca','12345 3 2 whatever sz=20 junk');
+ ANALYZE sqlite_master;
+ SELECT count(a) FROM t1;
+} {6}
+do_execsql_test 5.1 {
+ EXPLAIN QUERY PLAN
+ SELECT count(a) FROM t1;
+} {/.*INDEX t1ab.*/}
+do_execsql_test 5.2 {
+ DELETE FROM sqlite_stat1;
+ INSERT INTO sqlite_stat1(tbl,idx,stat)
+ VALUES('t1','t1ca','12345 3 2 x=5 sz=10 y=10'),
+ ('t1','t1ab','12345 3 2 whatever sz=20 junk');
+ ANALYZE sqlite_master;
+ SELECT count(a) FROM t1;
+} {6}
+do_execsql_test 5.3 {
+ EXPLAIN QUERY PLAN
+ SELECT count(a) FROM t1;
+} {/.*INDEX t1ca.*/}
+
+
+
+
+finish_test