OLD | NEW |
1 # 2010 September 24 | 1 # 2010 September 24 |
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 if {[info exists prevpageno] && $prevpageno != $pageno-1} { | 58 if {[info exists prevpageno] && $prevpageno != $pageno-1} { |
59 incr nFrag | 59 incr nFrag |
60 } | 60 } |
61 set prevpageno $pageno | 61 set prevpageno $pageno |
62 } | 62 } |
63 execsql { DROP TABLE temp.stat } | 63 execsql { DROP TABLE temp.stat } |
64 set nFrag | 64 set nFrag |
65 } | 65 } |
66 | 66 |
67 | 67 |
68 # EVIDENCE-OF: R-63707-33375 -- syntax diagram vacuum-stmt | 68 # -- syntax diagram vacuum-stmt |
69 # | 69 # |
70 do_execsql_test e_vacuum-0.1 { VACUUM } {} | 70 do_execsql_test e_vacuum-0.1 { VACUUM } {} |
71 | 71 |
72 # EVIDENCE-OF: R-51469-36013 Unless SQLite is running in | 72 # EVIDENCE-OF: R-51469-36013 Unless SQLite is running in |
73 # "auto_vacuum=FULL" mode, when a large amount of data is deleted from | 73 # "auto_vacuum=FULL" mode, when a large amount of data is deleted from |
74 # the database file it leaves behind empty space, or "free" database | 74 # the database file it leaves behind empty space, or "free" database |
75 # pages. | 75 # pages. |
76 # | 76 # |
77 # EVIDENCE-OF: R-60541-63059 Running VACUUM to rebuild the database | 77 # EVIDENCE-OF: R-60541-63059 Running VACUUM to rebuild the database |
78 # reclaims this space and reduces the size of the database file. | 78 # reclaims this space and reduces the size of the database file. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 # | 115 # |
116 # EVIDENCE-OF: R-05791-54928 Running VACUUM ensures that each table and | 116 # EVIDENCE-OF: R-05791-54928 Running VACUUM ensures that each table and |
117 # index is largely stored contiguously within the database file. | 117 # index is largely stored contiguously within the database file. |
118 # | 118 # |
119 # e_vacuum-1.2.1 - Perform many INSERT, UPDATE and DELETE ops on table t1. | 119 # e_vacuum-1.2.1 - Perform many INSERT, UPDATE and DELETE ops on table t1. |
120 # e_vacuum-1.2.2 - Verify that t1 and its indexes are now quite fragmented. | 120 # e_vacuum-1.2.2 - Verify that t1 and its indexes are now quite fragmented. |
121 # e_vacuum-1.2.3 - Run VACUUM. | 121 # e_vacuum-1.2.3 - Run VACUUM. |
122 # e_vacuum-1.2.4 - Verify that t1 and its indexes are now much | 122 # e_vacuum-1.2.4 - Verify that t1 and its indexes are now much |
123 # less fragmented. | 123 # less fragmented. |
124 # | 124 # |
125 ifcapable vtab { | 125 ifcapable vtab&&compound { |
126 create_db | 126 create_db |
127 register_dbstat_vtab db | 127 register_dbstat_vtab db |
128 do_execsql_test e_vacuum-1.2.1 { | 128 do_execsql_test e_vacuum-1.2.1 { |
129 DELETE FROM t1 WHERE a%2; | 129 DELETE FROM t1 WHERE a%2; |
130 INSERT INTO t1 SELECT b, a FROM t2 WHERE a%2; | 130 INSERT INTO t1 SELECT b, a FROM t2 WHERE a%2; |
131 UPDATE t1 SET b=randomblob(600) WHERE (a%2)==0; | 131 UPDATE t1 SET b=randomblob(600) WHERE (a%2)==0; |
132 } {} | 132 } {} |
133 | 133 |
134 do_test e_vacuum-1.2.2.1 { expr [fragment_count t1]>100 } 1 | 134 do_test e_vacuum-1.2.2.1 { expr [fragment_count t1]>100 } 1 |
135 do_test e_vacuum-1.2.2.2 { expr [fragment_count sqlite_autoindex_t1_1]>100 } 1 | 135 do_test e_vacuum-1.2.2.2 { expr [fragment_count sqlite_autoindex_t1_1]>100 } 1 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 create_db { PRAGMA auto_vacuum = INCREMENTAL } | 294 create_db { PRAGMA auto_vacuum = INCREMENTAL } |
295 execsql { | 295 execsql { |
296 DELETE FROM t1; | 296 DELETE FROM t1; |
297 DELETE FROM t2; | 297 DELETE FROM t2; |
298 PRAGMA incremental_vacuum; | 298 PRAGMA incremental_vacuum; |
299 } | 299 } |
300 expr {[file size test.db] / 1024} | 300 expr {[file size test.db] / 1024} |
301 } {8} | 301 } {8} |
302 | 302 |
303 finish_test | 303 finish_test |
OLD | NEW |