1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-25 09:59:22 +03:00
Files
sqlite/test/analyzeG.test
dan 3b50f0d19a Experimental planner change to avoid a skip-scan if a regular index scan on
the same index columns can be done instead.

FossilOrigin-Name: 32924446db0d07e5b2661a6626136a7bcdda629de23f98f3e1e862dd52d2f8a5
2018-07-04 14:28:07 +00:00

55 lines
1.1 KiB
Plaintext

# 2018-07-04
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set ::testprefix analyzeG
ifcapable {!stat4} {
finish_test
return
}
do_execsql_test 1.0 {
CREATE TABLE t1(a, b, c, d);
CREATE INDEX t1abc ON t1(a, b, c);
WITH s(i) AS (
SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<100000
)
INSERT INTO t1 SELECT 1,1,1,1 FROM s;
WITH s(i) AS (
SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000
)
INSERT INTO t1 SELECT i%5,i,i,i FROM s;
}
do_execsql_test 1.1 {
EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=1 AND b=1 AND c>0
} {
3 0 0 {SEARCH TABLE t1 USING INDEX t1abc (a=? AND b=? AND c>?)}
}
do_execsql_test 1.3 {
ANALYZE
} {}
do_execsql_test 1.4 {
EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=1 AND b=1 AND c>0
} {
2 0 0 {SCAN TABLE t1}
}
finish_test