mirror of
https://github.com/sqlite/sqlite.git
synced 2025-09-02 12:21:26 +03:00
Begin a branch that experimentally replaces sqlite_stat2 with a new table
called sqlite_stat3 that will hopefully facilitate better query planning decisions. FossilOrigin-Name: 52e1d7e8ddd4bb5ef3a9d00fd2d719a8a784f807
This commit is contained in:
@@ -2324,7 +2324,11 @@ ifcapable compound&&subquery {
|
||||
ifcapable stat2 {
|
||||
set stat2 "sqlite_stat2 "
|
||||
} else {
|
||||
set stat2 ""
|
||||
ifcapable stat3 {
|
||||
set stat2 "sqlite_stat3 "
|
||||
} else {
|
||||
set stat2 ""
|
||||
}
|
||||
}
|
||||
do_test auth-5.2 {
|
||||
execsql {
|
||||
|
56
test/stat3.test
Normal file
56
test/stat3.test
Normal file
@@ -0,0 +1,56 @@
|
||||
# 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_STAT2 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,sampleno,sample,neq,nlt);
|
||||
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
|
Reference in New Issue
Block a user