3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
12 # This file verifies that INSERT operations with a very large number of
13 # VALUE terms works and does not hit the SQLITE_LIMIT_COMPOUND_SELECT limit.
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 set testprefix selectG
20 # Do an INSERT with a VALUES clause that contains 100,000 entries. Verify
21 # that this insert happens quickly (in less than 10 seconds). Actually, the
22 # insert will normally happen in less than 0.5 seconds on a workstation, but
23 # we allow plenty of overhead for slower machines. The speed test checks
24 # for an O(N*N) inefficiency that was once in the code and that would make
25 # the insert run for over a minute.
28 set sql "CREATE TABLE t1(x);\nINSERT INTO t1(x) VALUES"
29 for {set i 1} {$i<100000} {incr i} {
33 set microsec [lindex [time {db eval $sql}] 0]
35 SELECT count(x), sum(x), avg(x), $microsec<10000000 FROM t1;
37 } {100000 5000050000 50000.5 1}