Experimental support for speeding up CREATE INDEX commands using an offline merge sort.

FossilOrigin-Name: 30dbf0feab0323250404e0741ac2716bcb6b0cbe
This commit is contained in:
dan
2011-07-12 14:28:05 +00:00
parent 80084ca8e8
commit a20fde64eb
9 changed files with 685 additions and 28 deletions
+70
View File
@@ -0,0 +1,70 @@
# 2011 July 9
#
# 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. The
# focus of this file is testing the CREATE INDEX statement.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix index4
do_execsql_test 1.1 {
BEGIN;
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(randomblob(102));
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 2
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 4
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 8
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 16
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 32
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 64
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 128
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 256
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 512
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 1024
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 2048
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 4096
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 8192
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 16384
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 32768
INSERT INTO t1 SELECT randomblob(102) FROM t1; -- 65536
COMMIT;
}
do_execsql_test 1.2 {
CREATE INDEX i1 ON t1(x);
}
do_execsql_test 1.3 {
PRAGMA integrity_check
} {ok}
# The same test again - this time with limited memory.
#
ifcapable memorymanage {
set soft_limit [sqlite3_soft_heap_limit 50000]
db close
sqlite3 db test.db
do_execsql_test 1.4 {
PRAGMA cache_size = 10;
CREATE INDEX i2 ON t1(x);
}
do_execsql_test 1.5 {
PRAGMA integrity_check
} {ok}
sqlite3_soft_heap_limit $soft_limit
}
finish_test