Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/test/wherelimit3.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / test / wherelimit3.test` 67 lines ยท 1469 bytes Raw Blame History 1 # 2024-06-06 2 # 3 # The author disclaims copyright to this source code. In place of 4 # a legal notice, here is a blessing: 5 # 6 # May you do good and not evil. 7 # May you find forgiveness for yourself and forgive others. 8 # May you share freely, never taking more than you give. 9 # 10 #*********************************************************************** 11 # 12 # Test cases for query plans using LIMIT 13 # 14 15 set testdir [file dirname $argv0] 16 source $testdir/tester.tcl 17 set testprefix wherelimit3 18 19 do_execsql_test 1.0 { 20 CREATE TABLE t1(a INT, b INT); 21 WITH RECURSIVE c(n) AS (VALUES(1) UNION ALL SELECT n+1 FROM c WHERE n<1000) 22 INSERT INTO t1 SELECT n, n FROM c; 23 CREATE INDEX t1a ON t1(a); 24 CREATE INDEX t1b ON t1(b); 25 ANALYZE; 26 } 27 28 do_eqp_test 1.1 { 29 SELECT * FROM t1 WHERE a>=100 AND a<300 ORDER BY b LIMIT 5; 30 } { 31 QUERY PLAN 32 |--SEARCH t1 USING INDEX t1a (a>? AND a=100 AND a<300 ORDER BY b LIMIT -1; 38 } { 39 QUERY PLAN 40 `--SCAN t1 USING INDEX t1b 41 } 42 } 43 44 set N [expr 5] 45 do_eqp_test 1.3 { 46 SELECT * FROM t1 WHERE a>=100 AND a<300 ORDER BY b LIMIT $::N; 47 } { 48 QUERY PLAN 49 |--SEARCH t1 USING INDEX t1a (a>? AND a=100 AND a<300 ORDER BY b LIMIT $::N; 57 } { 58 QUERY PLAN 59 `--SCAN t1 USING INDEX t1b 60 } 61 } 62 63 64 65 66 67 finish_test