| OLD | NEW |
| (Empty) |
| 1 # 2015-01-05 | |
| 2 # | |
| 3 # The author disclaims copyright to this source code. In place of | |
| 4 # a legal notice, here is a blessing: | |
| 5 # | |
| 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. | |
| 9 # | |
| 10 #*********************************************************************** | |
| 11 # | |
| 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. | |
| 14 # | |
| 15 | |
| 16 set testdir [file dirname $argv0] | |
| 17 source $testdir/tester.tcl | |
| 18 set testprefix selectG | |
| 19 | |
| 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. | |
| 26 # | |
| 27 do_test 100 { | |
| 28 set sql "CREATE TABLE t1(x);\nINSERT INTO t1(x) VALUES" | |
| 29 for {set i 1} {$i<100000} {incr i} { | |
| 30 append sql "($i)," | |
| 31 } | |
| 32 append sql "($i);" | |
| 33 set microsec [lindex [time {db eval $sql}] 0] | |
| 34 db eval { | |
| 35 SELECT count(x), sum(x), avg(x), $microsec<10000000 FROM t1; | |
| 36 } | |
| 37 } {100000 5000050000 50000.5 1} | |
| 38 | |
| 39 finish_test | |
| OLD | NEW |