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 #*********************************************************************** |
11 # This file implements regression tests for SQLite library. The | 11 # This file implements regression tests for SQLite library. The |
12 # focus of this file is testing the multi-index OR clause optimizer. | 12 # focus of this file is testing the multi-index OR clause optimizer. |
13 # | |
14 # $Id: where7.test,v 1.9 2009/06/07 23:45:11 drh Exp $ | |
15 | 13 |
16 set testdir [file dirname $argv0] | 14 set testdir [file dirname $argv0] |
17 source $testdir/tester.tcl | 15 source $testdir/tester.tcl |
18 | 16 |
19 ifcapable !or_opt { | 17 ifcapable !or_opt { |
20 finish_test | 18 finish_test |
21 return | 19 return |
22 } | 20 } |
23 | 21 |
24 # Evaluate SQL. Return the result set followed by the | 22 # Evaluate SQL. Return the result set followed by the |
(...skipping 23273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
23298 OR (d>=22.0 AND d<23.0 AND d NOT NULL) | 23296 OR (d>=22.0 AND d<23.0 AND d NOT NULL) |
23299 OR a=91 | 23297 OR a=91 |
23300 } | 23298 } |
23301 } {2 22 23 28 54 80 91 scan 0 sort 0} | 23299 } {2 22 23 28 54 80 91 scan 0 sort 0} |
23302 | 23300 |
23303 # test case for the performance regression fixed by | 23301 # test case for the performance regression fixed by |
23304 # check-in 28ba6255282b on 2010-10-21 02:05:06 | 23302 # check-in 28ba6255282b on 2010-10-21 02:05:06 |
23305 # | 23303 # |
23306 # The test case that follows is code from an actual | 23304 # The test case that follows is code from an actual |
23307 # application with identifiers change and unused columns | 23305 # application with identifiers change and unused columns |
23308 # remove. | 23306 # removed. |
23309 # | 23307 # |
23310 do_execsql_test where7-3.1 { | 23308 do_execsql_test where7-3.1 { |
23311 CREATE TABLE t301 ( | 23309 CREATE TABLE t301 ( |
23312 c8 INTEGER PRIMARY KEY, | 23310 c8 INTEGER PRIMARY KEY, |
23313 c6 INTEGER, | 23311 c6 INTEGER, |
23314 c4 INTEGER, | 23312 c4 INTEGER, |
23315 c7 INTEGER, | 23313 c7 INTEGER, |
23316 FOREIGN KEY (c4) REFERENCES series(c4) | 23314 FOREIGN KEY (c4) REFERENCES series(c4) |
23317 ); | 23315 ); |
23318 CREATE INDEX t301_c6 on t301(c6); | 23316 CREATE INDEX t301_c6 on t301(c6); |
23319 CREATE INDEX t301_c4 on t301(c4); | 23317 CREATE INDEX t301_c4 on t301(c4); |
23320 CREATE INDEX t301_c7 on t301(c7); | 23318 CREATE INDEX t301_c7 on t301(c7); |
23321 | 23319 |
23322 CREATE TABLE t302 ( | 23320 CREATE TABLE t302 ( |
23323 c1 INTEGER PRIMARY KEY, | 23321 c1 INTEGER PRIMARY KEY, |
23324 c8 INTEGER, | 23322 c8 INTEGER, |
23325 c5 INTEGER, | 23323 c5 INTEGER, |
23326 c3 INTEGER, | 23324 c3 INTEGER, |
23327 c2 INTEGER, | 23325 c2 INTEGER, |
23328 c4 INTEGER, | 23326 c4 INTEGER, |
23329 FOREIGN KEY (c8) REFERENCES t301(c8) | 23327 FOREIGN KEY (c8) REFERENCES t301(c8) |
23330 ); | 23328 ); |
23331 CREATE INDEX t302_c3 on t302(c3); | 23329 CREATE INDEX t302_c3 on t302(c3); |
23332 CREATE INDEX t302_c8_c3 on t302(c8, c3); | 23330 CREATE INDEX t302_c8_c3 on t302(c8, c3); |
23333 CREATE INDEX t302_c5 on t302(c5); | 23331 CREATE INDEX t302_c5 on t302(c5); |
23334 | 23332 |
23335 EXPLAIN QUERY PLAN | 23333 EXPLAIN QUERY PLAN |
23336 SELECT t302.c1 | 23334 SELECT t302.c1 |
23337 FROM t302 JOIN t301 ON t302.c8 = t301.c8 | 23335 FROM t302 JOIN t301 ON t302.c8 = +t301.c8 |
23338 WHERE t302.c2 = 19571 | 23336 WHERE t302.c2 = 19571 |
23339 AND t302.c3 > 1287603136 | 23337 AND t302.c3 > 1287603136 |
23340 AND (t301.c4 = 1407449685622784 | 23338 AND (t301.c4 = 1407449685622784 |
23341 OR t301.c8 = 1407424651264000) | 23339 OR t301.c8 = 1407424651264000) |
23342 ORDER BY t302.c5 LIMIT 200; | 23340 ORDER BY t302.c5 LIMIT 200; |
23343 } { | 23341 } { |
23344 0 0 1 {SEARCH TABLE t301 USING COVERING INDEX t301_c4 (c4=?) (~10 rows)} | 23342 0 0 1 {SEARCH TABLE t301 USING COVERING INDEX t301_c4 (c4=?)} |
23345 0 0 1 {SEARCH TABLE t301 USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)} | 23343 0 0 1 {SEARCH TABLE t301 USING INTEGER PRIMARY KEY (rowid=?)} |
23346 0 1 0 {SEARCH TABLE t302 USING INDEX t302_c8_c3 (c8=? AND c3>?) (~2 rows)} | 23344 0 1 0 {SEARCH TABLE t302 USING INDEX t302_c8_c3 (c8=? AND c3>?)} |
23347 0 0 0 {USE TEMP B-TREE FOR ORDER BY} | 23345 0 0 0 {USE TEMP B-TREE FOR ORDER BY} |
23348 } | 23346 } |
23349 | 23347 |
23350 finish_test | 23348 finish_test |
OLD | NEW |