diff options
author | danielk1977 <danielk1977@noemail.net> | 2009-03-05 14:59:39 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2009-03-05 14:59:39 +0000 |
commit | 6fa0fe13f0926740e9b7b3435df37347ae2a7afa (patch) | |
tree | 23e94faca1a4badb37730ab74f3d90ccc9bf6632 /test/pcache.test | |
parent | c427740b780496b3a041f45ac4a719baf1d2e09d (diff) | |
download | sqlite-6fa0fe13f0926740e9b7b3435df37347ae2a7afa.tar.gz sqlite-6fa0fe13f0926740e9b7b3435df37347ae2a7afa.zip |
Begin purging dirty pages from the cache once 90% of the cache is dirty (insteadof waiting until it is 100% dirty). This improves performance in some circumstances by effectively reserving 10% of the configured page-cache for frequently reused read-only pages. (CVS 6341)
FossilOrigin-Name: 823fe7f5551e121e211d1ede606a7ce7487ffe0d
Diffstat (limited to 'test/pcache.test')
-rw-r--r-- | test/pcache.test | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/test/pcache.test b/test/pcache.test index ad024fc37..56e10fdea 100644 --- a/test/pcache.test +++ b/test/pcache.test @@ -11,7 +11,7 @@ # # This file is focused on testing the pcache module. # -# $Id: pcache.test,v 1.3 2009/01/07 15:33:46 drh Exp $ +# $Id: pcache.test,v 1.4 2009/03/05 14:59:40 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -30,11 +30,11 @@ do_test pcache-1.1 { do_test pcache-1.2 { sqlite3 db test.db execsql { - PRAGMA cache_size=10; + PRAGMA cache_size=12; PRAGMA auto_vacuum=0; } pcache_stats -} {current 1 max 10 min 10 recyclable 1} +} {current 1 max 12 min 10 recyclable 1} do_test pcache-1.3 { execsql { @@ -46,7 +46,7 @@ do_test pcache-1.3 { CREATE TABLE t5(a, b, c); } pcache_stats -} {current 6 max 10 min 10 recyclable 0} +} {current 6 max 12 min 10 recyclable 0} do_test pcache-1.4 { execsql { @@ -56,13 +56,13 @@ do_test pcache-1.4 { CREATE TABLE t9(a, b, c); } pcache_stats -} {current 10 max 10 min 10 recyclable 0} +} {current 10 max 12 min 10 recyclable 0} do_test pcache-1.5 { sqlite3 db2 test.db execsql "PRAGMA cache_size=10" db2 pcache_stats -} {current 11 max 20 min 20 recyclable 1} +} {current 11 max 22 min 20 recyclable 1} do_test pcache-1.6.1 { execsql { @@ -70,7 +70,7 @@ do_test pcache-1.6.1 { SELECT * FROM sqlite_master; } db2 pcache_stats -} {current 11 max 20 min 20 recyclable 0} +} {current 11 max 22 min 20 recyclable 0} # At this point connection db2 has a read lock on the database file and a # single pinned page in its cache. Connection [db] is holding 10 dirty @@ -87,16 +87,18 @@ do_test pcache-1.6.2 { CREATE INDEX i7 ON t7(a, b); CREATE INDEX i8 ON t8(a, b); CREATE INDEX i9 ON t9(a, b); + CREATE INDEX i10 ON t9(a, b); + CREATE INDEX i11 ON t9(a, b); } pcache_stats -} {current 20 max 20 min 20 recyclable 0} +} {current 23 max 22 min 20 recyclable 0} do_test pcache-1.7 { execsql { CREATE TABLE t10(a, b, c); } pcache_stats -} {current 21 max 20 min 20 recyclable 0} +} {current 24 max 22 min 20 recyclable 0} # Rolling back the transaction held by db2 at this point releases a pinned # page. Because the number of allocated pages is greater than the @@ -106,22 +108,22 @@ do_test pcache-1.7 { do_test pcache-1.8 { execsql {ROLLBACK} db2 pcache_stats -} {current 20 max 20 min 20 recyclable 0} +} {current 23 max 22 min 20 recyclable 0} do_test pcache-1.9 { execsql COMMIT pcache_stats -} {current 20 max 20 min 20 recyclable 20} +} {current 22 max 22 min 20 recyclable 22} do_test pcache-1.10 { db2 close pcache_stats -} {current 10 max 10 min 10 recyclable 10} +} {current 12 max 12 min 10 recyclable 12} do_test pcache-1.11 { execsql { PRAGMA cache_size = 20 } pcache_stats -} {current 10 max 20 min 10 recyclable 10} +} {current 12 max 20 min 10 recyclable 12} do_test pcache-1.12 { execsql { |