OLD | NEW |
1 # 2011 January 04 | 1 # 2011 January 04 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 20 matching lines...) Expand all Loading... |
31 INSERT INTO t1 SELECT a+4, b FROM t1; | 31 INSERT INTO t1 SELECT a+4, b FROM t1; |
32 INSERT INTO t1 SELECT a+8, b FROM t1; | 32 INSERT INTO t1 SELECT a+8, b FROM t1; |
33 INSERT INTO t1 SELECT a+16, b FROM t1; | 33 INSERT INTO t1 SELECT a+16, b FROM t1; |
34 INSERT INTO t1 SELECT a+32, b FROM t1; | 34 INSERT INTO t1 SELECT a+32, b FROM t1; |
35 INSERT INTO t1 SELECT a+64, b FROM t1; | 35 INSERT INTO t1 SELECT a+64, b FROM t1; |
36 ANALYZE; | 36 ANALYZE; |
37 } | 37 } |
38 | 38 |
39 # Should choose the t1a index since it is more specific than t1b. | 39 # Should choose the t1a index since it is more specific than t1b. |
40 db eval {EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=5 AND b IS NULL} | 40 db eval {EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=5 AND b IS NULL} |
41 } {0 0 0 {SEARCH TABLE t1 USING INDEX t1a (a=?) (~1 rows)}} | 41 } {0 0 0 {SEARCH TABLE t1 USING INDEX t1a (a=?)}} |
42 | 42 |
43 # Verify that the t1b index shows that it does not narrow down the | 43 # Verify that the t1b index shows that it does not narrow down the |
44 # search any at all. | 44 # search any at all. |
45 # | 45 # |
46 do_test analyze4-1.1 { | 46 do_test analyze4-1.1 { |
47 db eval { | 47 db eval { |
48 SELECT idx, stat FROM sqlite_stat1 WHERE tbl='t1' ORDER BY idx; | 48 SELECT idx, stat FROM sqlite_stat1 WHERE tbl='t1' ORDER BY idx; |
49 } | 49 } |
50 } {t1a {128 1} t1b {128 128}} | 50 } {t1a {128 1} t1b {128 128}} |
51 | 51 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 INSERT INTO t2 VALUES(5, 'aBc', 'aBc', 'aBc'); | 102 INSERT INTO t2 VALUES(5, 'aBc', 'aBc', 'aBc'); |
103 INSERT INTO t2 VALUES(6, 'aBC', 'aBC', 'aBC'); | 103 INSERT INTO t2 VALUES(6, 'aBC', 'aBC', 'aBC'); |
104 INSERT INTO t2 VALUES(7, 'aBc ', 'aBc ', 'aBc '); | 104 INSERT INTO t2 VALUES(7, 'aBc ', 'aBc ', 'aBc '); |
105 INSERT INTO t2 VALUES(8, 'aBC ', 'aBC ', 'aBC '); | 105 INSERT INTO t2 VALUES(8, 'aBC ', 'aBC ', 'aBC '); |
106 ANALYZE; | 106 ANALYZE; |
107 SELECT idx, stat FROM sqlite_stat1 WHERE tbl='t2' ORDER BY idx; | 107 SELECT idx, stat FROM sqlite_stat1 WHERE tbl='t2' ORDER BY idx; |
108 } | 108 } |
109 } {t2a {8 4} t2b {8 2} t2c {8 1} t2c2 {8 4} t2c3 {8 2}} | 109 } {t2a {8 4} t2b {8 2} t2c {8 1} t2c2 {8 4} t2c3 {8 2}} |
110 | 110 |
111 finish_test | 111 finish_test |
OLD | NEW |