OLD | NEW |
1 # 2014 September 15. | 1 # 2014 September 15. |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 execsql COMMIT | 35 execsql COMMIT |
36 } {} | 36 } {} |
37 | 37 |
38 do_execsql_test 1.2 { | 38 do_execsql_test 1.2 { |
39 CREATE INDEX i1 ON t1(b); | 39 CREATE INDEX i1 ON t1(b); |
40 } | 40 } |
41 | 41 |
42 db close | 42 db close |
43 tvfs delete | 43 tvfs delete |
| 44 |
| 45 #------------------------------------------------------------------------- |
| 46 # Test that the PMA size is determined correctly. The PMA size should be |
| 47 # roughly the same amount of memory allocated to the main pager cache, or |
| 48 # 250 pages if this is larger. |
| 49 # |
| 50 testvfs tvfs |
| 51 tvfs script tv_callback |
| 52 tvfs filter {xOpen xWrite} |
| 53 |
| 54 proc tv_callback {method args} { |
| 55 global iTemp |
| 56 global F |
| 57 switch $method { |
| 58 xOpen { |
| 59 if {[lindex $args 0]==""} { return "temp[incr iTemp]" } |
| 60 return "SQLITE_OK" |
| 61 } |
| 62 |
| 63 xWrite { |
| 64 foreach {filename id off amt} $args {} |
| 65 if {[info exists F($id)]==0 || $F($id)<($off + $amt)} { |
| 66 set F($id) [expr $off+$amt] |
| 67 } |
| 68 } |
| 69 } |
| 70 } |
| 71 |
| 72 catch { db close } |
| 73 forcedelete test.db |
| 74 sqlite3 db test.db -vfs tvfs |
| 75 execsql { CREATE TABLE t1(x) } |
| 76 |
| 77 # Each iteration of the following loop attempts to sort 10001 records |
| 78 # each a bit over 100 bytes in size. In total a little more than 1MiB |
| 79 # of data. |
| 80 # |
| 81 foreach {tn pgsz cachesz bTemp} { |
| 82 1 4096 1000 0 |
| 83 2 1024 1000 1 |
| 84 |
| 85 3 4096 -1000 1 |
| 86 4 1024 -1000 1 |
| 87 |
| 88 5 4096 -9000 0 |
| 89 6 1024 -9000 0 |
| 90 } { |
| 91 do_execsql_test 2.$tn.0 " |
| 92 PRAGMA page_size = $pgsz; |
| 93 VACUUM; |
| 94 PRAGMA cache_size = $cachesz; |
| 95 " |
| 96 |
| 97 if {[db one {PRAGMA page_size}]!=$pgsz} { |
| 98 # SEE is not able to change page sizes and that messes up the |
| 99 # results that follow. |
| 100 continue |
| 101 } |
| 102 |
| 103 do_test 2.$tn.1 { |
| 104 set ::iTemp 0 |
| 105 catch { array unset F } |
| 106 execsql { |
| 107 WITH x(i, j) AS ( |
| 108 SELECT 1, randomblob(100) |
| 109 UNION ALL |
| 110 SELECT i+1, randomblob(100) FROM x WHERE i<10000 |
| 111 ) |
| 112 SELECT * FROM x ORDER BY j; |
| 113 } |
| 114 expr {[array names F]!=""} |
| 115 } $bTemp |
| 116 } |
| 117 |
44 finish_test | 118 finish_test |
45 | |
OLD | NEW |