Files
sqlite/test/stat3.test
T
drh 4e50c5ec48 Further testing and bug fixing for sqlite_stat3. Added the Index.avgEq
field to index statistics.  Fixed several problems in the query planner
associated with stat3.

FossilOrigin-Name: 89b2f70884cad0abdf4c66cb64ecddb2820ded74
2011-08-13 19:35:19 +00:00

57 lines
1.5 KiB
Plaintext

# 2011 August 08
#
# 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.
#
#***********************************************************************
#
# This file implements regression tests for SQLite library. This file
# implements tests for the extra functionality provided by the ANALYZE
# command when the library is compiled with SQLITE_ENABLE_STAT3 defined.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix stat3
# Verify that if not compiled with SQLITE_ENABLE_STAT2 that the ANALYZE
# command will delete the sqlite_stat2 table. Likewise, if not compiled
# with SQLITE_ENABLE_STAT3, the sqlite_stat3 table is deleted.
#
do_test 1.1 {
db eval {
PRAGMA writable_schema=ON;
CREATE TABLE sqlite_stat2(tbl,idx,sampleno,sample);
CREATE TABLE sqlite_stat3(tbl,idx,neq,nlt,ndlt,sample);
SELECT name FROM sqlite_master ORDER BY 1;
}
} {sqlite_stat2 sqlite_stat3}
do_test 1.2 {
db close
sqlite3 db test.db
db eval {SELECT name FROM sqlite_master ORDER BY 1}
} {sqlite_stat2 sqlite_stat3}
ifcapable {stat3} {
do_test 1.3 {
db eval {ANALYZE; SELECT name FROM sqlite_master ORDER BY 1}
} {sqlite_stat1 sqlite_stat3}
} else {
do_test 1.4 {
db eval {ANALYZE; SELECT name FROM sqlite_master ORDER BY 1}
} {sqlite_stat1}
finish_test
return
}
finish_test