OLD | NEW |
1 # 2008 December 23 | 1 # 2008 December 23 |
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 count_steps { | 83 count_steps { |
84 SELECT a FROM t1 WHERE (b=3 OR c>=10) | 84 SELECT a FROM t1 WHERE (b=3 OR c>=10) |
85 } | 85 } |
86 } {2 4 5 scan 0 sort 0} | 86 } {2 4 5 scan 0 sort 0} |
87 do_test where7-1.9 { | 87 do_test where7-1.9 { |
88 count_steps { | 88 count_steps { |
89 SELECT a FROM t1 WHERE (b=3 OR c>=10 OR c=4) | 89 SELECT a FROM t1 WHERE (b=3 OR c>=10 OR c=4) |
90 } | 90 } |
91 } {2 4 5 scan 0 sort 0} | 91 } {2 4 5 scan 0 sort 0} |
92 do_test where7-1.10 { | 92 do_test where7-1.10 { |
93 breakpoint | |
94 count_steps { | 93 count_steps { |
95 SELECT a FROM t1 WHERE (b=3 OR c>=10 OR c=4 OR b>10) | 94 SELECT a FROM t1 WHERE (b=3 OR c>=10 OR c=4 OR b>10) |
96 } | 95 } |
97 } {2 4 5 scan 0 sort 0} | 96 } {2 4 5 scan 0 sort 0} |
98 breakpoint | |
99 do_test where7-1.11 { | 97 do_test where7-1.11 { |
100 count_steps { | 98 count_steps { |
101 SELECT a FROM t1 WHERE (d=5 AND b=3) OR c==100 ORDER BY a; | 99 SELECT a FROM t1 WHERE (d=5 AND b=3) OR c==100 ORDER BY a; |
102 } | 100 } |
103 } {2 5 scan 0 sort 1} | 101 } {2 5 scan 0 sort 1} |
104 do_test where7-1.12 { | 102 do_test where7-1.12 { |
105 count_steps { | 103 count_steps { |
106 SELECT a FROM t1 WHERE (b BETWEEN 2 AND 4) OR c=100 ORDER BY a | 104 SELECT a FROM t1 WHERE (b BETWEEN 2 AND 4) OR c=100 ORDER BY a |
107 } | 105 } |
108 } {1 2 3 5 scan 0 sort 1} | 106 } {1 2 3 5 scan 0 sort 1} |
109 do_test where7-1.13.1 { | 107 do_test where7-1.13 { |
110 count_steps { | |
111 SELECT a FROM t1 WHERE (b BETWEEN 0 AND 2) OR (c BETWEEN 9 AND 999) | |
112 ORDER BY a DESC | |
113 } | |
114 } {5 4 1 scan 4 sort 0} | |
115 do_test where7-1.13.2 { | |
116 count_steps { | 108 count_steps { |
117 SELECT a FROM t1 WHERE (b BETWEEN 0 AND 2) OR (c BETWEEN 9 AND 999) | 109 SELECT a FROM t1 WHERE (b BETWEEN 0 AND 2) OR (c BETWEEN 9 AND 999) |
118 ORDER BY +a DESC | 110 ORDER BY +a DESC |
119 } | 111 } |
120 } {5 4 1 scan 0 sort 1} | 112 } {5 4 1 scan 0 sort 1} |
121 | 113 |
122 do_test where7-1.14 { | 114 do_test where7-1.14 { |
123 count_steps { | 115 count_steps { |
124 SELECT a FROM t1 WHERE (d=8 OR c=6 OR b=4) AND +a>0 | 116 SELECT a FROM t1 WHERE (d=8 OR c=6 OR b=4) AND +a>0 |
125 } | 117 } |
(...skipping 23174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
23300 count_steps_sort { | 23292 count_steps_sort { |
23301 SELECT a FROM t3 | 23293 SELECT a FROM t3 |
23302 WHERE b=1092 | 23294 WHERE b=1092 |
23303 OR a=23 | 23295 OR a=23 |
23304 OR (f GLOB '?defg*' AND f GLOB 'cdef*') | 23296 OR (f GLOB '?defg*' AND f GLOB 'cdef*') |
23305 OR d<0.0 | 23297 OR d<0.0 |
23306 OR (d>=22.0 AND d<23.0 AND d NOT NULL) | 23298 OR (d>=22.0 AND d<23.0 AND d NOT NULL) |
23307 OR a=91 | 23299 OR a=91 |
23308 } | 23300 } |
23309 } {2 22 23 28 54 80 91 scan 0 sort 0} | 23301 } {2 22 23 28 54 80 91 scan 0 sort 0} |
23310 finish_test | 23302 |
| 23303 # test case for the performance regression fixed by |
| 23304 # check-in 28ba6255282b on 2010-10-21 02:05:06 |
| 23305 # |
| 23306 # The test case that follows is code from an actual |
| 23307 # application with identifiers change and unused columns |
| 23308 # remove. |
| 23309 # |
| 23310 do_execsql_test where7-3.1 { |
| 23311 CREATE TABLE t301 ( |
| 23312 c8 INTEGER PRIMARY KEY, |
| 23313 c6 INTEGER, |
| 23314 c4 INTEGER, |
| 23315 c7 INTEGER, |
| 23316 FOREIGN KEY (c4) REFERENCES series(c4) |
| 23317 ); |
| 23318 CREATE INDEX t301_c6 on t301(c6); |
| 23319 CREATE INDEX t301_c4 on t301(c4); |
| 23320 CREATE INDEX t301_c7 on t301(c7); |
| 23321 |
| 23322 CREATE TABLE t302 ( |
| 23323 c1 INTEGER PRIMARY KEY, |
| 23324 c8 INTEGER, |
| 23325 c5 INTEGER, |
| 23326 c3 INTEGER, |
| 23327 c2 INTEGER, |
| 23328 c4 INTEGER, |
| 23329 FOREIGN KEY (c8) REFERENCES t301(c8) |
| 23330 ); |
| 23331 CREATE INDEX t302_c3 on t302(c3); |
| 23332 CREATE INDEX t302_c8_c3 on t302(c8, c3); |
| 23333 CREATE INDEX t302_c5 on t302(c5); |
| 23334 |
| 23335 EXPLAIN QUERY PLAN |
| 23336 SELECT t302.c1 |
| 23337 FROM t302 JOIN t301 ON t302.c8 = t301.c8 |
| 23338 WHERE t302.c2 = 19571 |
| 23339 AND t302.c3 > 1287603136 |
| 23340 AND (t301.c4 = 1407449685622784 |
| 23341 OR t301.c8 = 1407424651264000) |
| 23342 ORDER BY t302.c5 LIMIT 200; |
| 23343 } { |
| 23344 0 0 1 {SEARCH TABLE t301 USING COVERING INDEX t301_c4 (c4=?) (~10 rows)} |
| 23345 0 0 1 {SEARCH TABLE t301 USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)} |
| 23346 0 1 0 {SEARCH TABLE t302 USING INDEX t302_c8_c3 (c8=? AND c3>?) (~2 rows)} |
| 23347 0 0 0 {USE TEMP B-TREE FOR ORDER BY} |
| 23348 } |
23311 | 23349 |
23312 finish_test | 23350 finish_test |
OLD | NEW |