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

Add an sqlite3_db_config() option - SQLITE_DBCONFIG_STMT_SCANSTATS - for enabling and disabling the collection of sqlite3_stmt_scanstats() statistics in SQLITE_ENABLE_STMT_SCANSTATUS builds. Collection of statistics is disabled by default.

FossilOrigin-Name: 0f5579bef27b84ee855065cfe87703c51e1f9773906a9e0d4e4dafc90bd0e553
This commit is contained in:
dan
2023-02-28 19:39:59 +00:00
parent 4990fc84f1
commit 45163fc45e
14 changed files with 155 additions and 95 deletions

View File

@ -45,6 +45,11 @@ proc do_scanstatus_test {tn res} {
uplevel [list do_test $tn [list set {} $ret] [list {*}$res]]
}
do_execsql_test 1.0a { SELECT count(*) FROM t1, t2; } 6
do_scanstatus_test 1.0b { }
sqlite3_db_config db STMT_SCANSTATS 1
do_execsql_test 1.1 { SELECT count(*) FROM t1, t2; } 6
do_scanstatus_test 1.2 {
nLoop 1 nVisit 2 nEst 1048576.0 zName t1 zExplain {SCAN t1}
@ -94,6 +99,7 @@ do_scanstatus_test 1.10 {
# Try a few different types of scans.
#
reset_db
sqlite3_db_config db STMT_SCANSTATS 1
do_execsql_test 2.1 {
CREATE TABLE x1(i INTEGER PRIMARY KEY, j);
INSERT INTO x1 VALUES(1, 'one');
@ -277,6 +283,7 @@ do_scanstatus_test 4.2.2 {
# Further tests of different scan types.
#
reset_db
sqlite3_db_config db STMT_SCANSTATS 1
proc tochar {i} {
set alphabet {a b c d e f g h i j k l m n o p q r s t u v w x y z}
return [lindex $alphabet [expr $i % [llength $alphabet]]]
@ -365,6 +372,7 @@ do_eqp_test 5.5.1 {
} {
QUERY PLAN
|--SCAN t3
|--BLOOM FILTER ON t1 (c=?)
`--SEARCH t1 USING AUTOMATIC COVERING INDEX (c=?)
}
do_execsql_test 5.5.2 {