Performance improvements to the external merge-sorter. Keep content on an

in-memory linked lists rather than an ephemeral table prior to spilling to
disk.  Use the external merge-sorter to implement ORDER BY and GROUP BY
in addition to CREATE INDEX.

FossilOrigin-Name: 4c43e8b2d2c1d8dcba3cd1c3f2ec4e19ab419430
This commit is contained in:
drh
2011-09-03 17:07:26 +00:00
17 changed files with 560 additions and 296 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ proc do_temptables_test {tn sql temptables} {
uplevel [list do_test $tn [subst -novar {
set ret ""
db eval "EXPLAIN [set sql]" {
if {$opcode == "OpenEphemeral"} {
if {$opcode == "OpenEphemeral" || $opcode == "SorterOpen"} {
if {$p5 != "10" && $p5!="00"} { error "p5 = $p5" }
if {$p5 == "10"} {
lappend ret hash
+14
View File
@@ -108,5 +108,19 @@ do_execsql_test 1.8 {
PRAGMA integrity_check
} {ok}
do_execsql_test 2.1 {
BEGIN;
CREATE TABLE t2(x);
INSERT INTO t2 VALUES(14);
INSERT INTO t2 VALUES(35);
INSERT INTO t2 VALUES(15);
INSERT INTO t2 VALUES(35);
INSERT INTO t2 VALUES(16);
COMMIT;
}
do_catchsql_test 2.2 {
CREATE UNIQUE INDEX i3 ON t2(x);
} {1 {indexed columns are not unique}}
finish_test
+1 -1
View File
@@ -270,7 +270,7 @@ ifcapable {explain} {
CREATE UNIQUE INDEX ex1i1 ON ex1(a);
EXPLAIN REINDEX;
}]
regexp { IsUnique \d+ \d+ \d+ \d+ } $x
regexp { SorterCompare \d+ \d+ \d+ } $x
} {1}
if {[regexp {16} [db one {PRAGMA encoding}]]} {
do_test misc3-6.11-utf16 {