OLD | NEW |
1 # 2005 July 22 | 1 # 2014-10-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 #*********************************************************************** |
11 # This file implements regression tests for SQLite library. | 11 # This file implements regression tests for SQLite library. |
12 # This file implements tests for the ANALYZE command. | 12 # This file implements tests for the ANALYZE command. |
13 # | 13 # |
14 # $Id: analyze.test,v 1.9 2008/08/11 18:44:58 drh Exp $ | |
15 | 14 |
16 set testdir [file dirname $argv0] | 15 set testdir [file dirname $argv0] |
17 source $testdir/tester.tcl | 16 source $testdir/tester.tcl |
18 set ::testprefix analyzeD | 17 set ::testprefix analyzeD |
19 | 18 |
20 ifcapable {!stat4} { | 19 ifcapable {!stat4} { |
21 finish_test | 20 finish_test |
22 return | 21 return |
23 } | 22 } |
24 | 23 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 0 0 0 {SEARCH TABLE t1 USING INDEX t1_c (c=?)} | 67 0 0 0 {SEARCH TABLE t1 USING INDEX t1_c (c=?)} |
69 } | 68 } |
70 | 69 |
71 do_test 1.3 { | 70 do_test 1.3 { |
72 execsql { DELETE FROM sqlite_stat1 } | 71 execsql { DELETE FROM sqlite_stat1 } |
73 db close | 72 db close |
74 sqlite3 db test.db | 73 sqlite3 db test.db |
75 } {} | 74 } {} |
76 | 75 |
77 # Without stat1, because 3001 is larger than all samples in the stat4 | 76 # Without stat1, because 3001 is larger than all samples in the stat4 |
78 # table, SQLite things that a=3001 matches just 1 row. So it (incorrectly) | 77 # table, SQLite thinks that a=3001 matches just 1 row. So it (incorrectly) |
79 # chooses it over the c=150 index (5 rows). Even with stat1 data, things | 78 # chooses it over the c=150 index (5 rows). Even with stat1 data, things |
80 # worked this way before commit [e6f7f97dbc]. | 79 # worked this way before commit [e6f7f97dbc]. |
81 # | 80 # |
82 do_eqp_test 1.4 { | 81 do_eqp_test 1.4 { |
83 SELECT * FROM t1 WHERE a=3001 AND c=150; | 82 SELECT * FROM t1 WHERE a=3001 AND c=150; |
84 } { | 83 } { |
85 0 0 0 {SEARCH TABLE t1 USING INDEX t1_ab (a=?)} | 84 0 0 0 {SEARCH TABLE t1 USING INDEX t1_ab (a=?)} |
86 } | 85 } |
87 | 86 |
88 do_test 1.5 { | 87 do_test 1.5 { |
(...skipping 18 matching lines...) Expand all Loading... |
107 # Same test as 1.4, except this time the 7 rows that match the a=? condition | 106 # Same test as 1.4, except this time the 7 rows that match the a=? condition |
108 # do not feature larger values than all rows in the stat4 table. So SQLite | 107 # do not feature larger values than all rows in the stat4 table. So SQLite |
109 # gets this right, even without stat1 data. | 108 # gets this right, even without stat1 data. |
110 do_eqp_test 1.8 { | 109 do_eqp_test 1.8 { |
111 SELECT * FROM t1 WHERE a=13 AND c=150; | 110 SELECT * FROM t1 WHERE a=13 AND c=150; |
112 } { | 111 } { |
113 0 0 0 {SEARCH TABLE t1 USING INDEX t1_c (c=?)} | 112 0 0 0 {SEARCH TABLE t1 USING INDEX t1_c (c=?)} |
114 } | 113 } |
115 | 114 |
116 finish_test | 115 finish_test |
117 | |
OLD | NEW |