1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Experimental change to explain query plan to identify covering indexes on expressions.

FossilOrigin-Name: 3bb03a2891e30c58b66e3665a8877a8eab4a8bac57ee153d8d31358caeaf4b7c
This commit is contained in:
dan
2024-10-11 20:36:26 +00:00
parent 4859bc9a9f
commit 14101a3c28
7 changed files with 142 additions and 44 deletions

View File

@ -78,6 +78,44 @@ do_hasfunction_test 1.6 {
2 {{"y":"two"}}
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE TABLE t1(a, b, j);
CREATE INDEX i1 ON t1( a, json_extract(j, '$.x') );
}
do_eqp_test 2.1 {
SELECT json_extract(j, '$.x') FROM t1 WHERE a=?
} {
t1 USING COVERING INDEX i1
}
do_eqp_test 2.2 {
SELECT b, json_extract(j, '$.x') FROM t1 WHERE a=?
} {
t1 USING INDEX i1
}
do_eqp_test 2.3 {
SELECT json_insert( '{}', json_extract(j, '$.x') ) FROM t1 WHERE a=?
} {
t1 USING INDEX i1
}
do_eqp_test 2.4 {
SELECT sum( json_extract(j, '$.x') ) FROM t1 WHERE a=?
} {
t1 USING COVERING INDEX i1
}
do_eqp_test 2.5 {
SELECT json_extract(j, '$.x'), sum( json_extract(j, '$.x') ) FROM t1 WHERE a=?
} {
t1 USING INDEX i1
}
finish_test