]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Change the way overflow pages are allocated from the free-list to increase the chance...
authordanielk1977 <danielk1977@noemail.net>
Thu, 17 May 2007 18:28:11 +0000 (18:28 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Thu, 17 May 2007 18:28:11 +0000 (18:28 +0000)
FossilOrigin-Name: b7391892041eb72b0ebcbb7a9a6721ae3482dd80

manifest
manifest.uuid
src/btree.c
test/speed3.test

index f4fb1becf6efdd0b2425c1b1307b621e04f316e6..a928db6f9efb8c36fb38e728079c9ff7ab52aff3 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Bring\sthe\sautoconf\sbased\sbuild\ssystem\sup\sto\sdate\swith\sthe\srecent\schanges.\s#2366,\s#2367\sand\s#2368.\s(CVS\s4022)
-D 2007-05-17T16:38:30
+C Change\sthe\sway\soverflow\spages\sare\sallocated\sfrom\sthe\sfree-list\sto\sincrease\sthe\schance\sthat\sthey\sare\sa\scontiguous\sblock.\sMuch\smore\scan\sstill\sbe\sdone.\s(CVS\s4023)
+D 2007-05-17T18:28:11
 F Makefile.in a42354804b50c2708ce72cf79e4daa30f50191b5
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -61,7 +61,7 @@ F src/alter.c 1b1deeb97446ed87f2fa17a3eb6236548841a348
 F src/analyze.c e8fcb1c35ace8418615eb18d9601f321ac86b2ec
 F src/attach.c ba628db0c2b6a362f036d017bf1196cdfe4ebb37
 F src/auth.c 5ea90bc93dfea46e9fe4bf531e14c7cd98219ecb
-F src/btree.c 911798b91bbad31a033ed501b95c76df8541874b
+F src/btree.c 9179039d9a023da986c168e276680fed9dcc57fd
 F src/btree.h 1d527bf61ed176f980c34999d5793a0fd45dcf8c
 F src/btreeInt.h f92c0577f49d961c0148b477a25647e8fd80eecf
 F src/build.c 50992d92e131a9aa9aa6657fb1ddc13e176fd70c
@@ -345,7 +345,7 @@ F test/shared_err.test cc528f6e78665787e93d9ce3a782a2ce5179d821
 F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
 F test/speed1.test 22e1b27af0683ed44dcd2f93ed817a9c3e65084a
 F test/speed2.test 53177056baf6556dcbdcf032bbdfc41c1aa74ded
-F test/speed3.test 2c1947ad95b0d5cbd41a485c62402911ef9fd541
+F test/speed3.test 27a71b5cc83c1f23baf6d0ee52e2f195e3c415f2
 F test/sqllimits1.test b15a5784e47199d68fa1182157ba7e790f467d9f
 F test/subquery.test ae324ee928c5fb463a3ce08a8860d6e7f1ca5797
 F test/subselect.test 974e87f8fc91c5f00dd565316d396a5a6c3106c4
@@ -493,7 +493,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P f2ce727c4d798c666e95876a2b67e8a305d82e3a
-R 7b00490089c9a9acc3bbd9b31f5ea738
+P ae644bc7aad229f2d219ea20eb4774318feb3051
+R 269f6950d9247c5d127e8dd163a6acb5
 U danielk1977
-Z 3e6e530a34bc48403e48b023fcadb804
+Z 028a3648b2f6bed3a2edcff1de5c489f
index 5c9585cc469497fcea172cfb039d3fdbc3a78c8a..8bd640d349a1b106b22a00de7f97abe22ffede08 100644 (file)
@@ -1 +1 @@
-ae644bc7aad229f2d219ea20eb4774318feb3051
\ No newline at end of file
+b7391892041eb72b0ebcbb7a9a6721ae3482dd80
\ No newline at end of file
index b3fd1f8bdfc100c84378e28bc44dbf2711a3823e..9bc1854cc41caee80a7ccdde8346b3f5f0340aaf 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.382 2007/05/16 17:28:43 danielk1977 Exp $
+** $Id: btree.c,v 1.383 2007/05/17 18:28:11 danielk1977 Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** See the header comment on "btreeInt.h" for additional information.
@@ -3843,10 +3843,21 @@ static int fillInCell(
 
   while( nPayload>0 ){
     if( spaceLeft==0 ){
+      int isExact = 0;
 #ifndef SQLITE_OMIT_AUTOVACUUM
       Pgno pgnoPtrmap = pgnoOvfl; /* Overflow page pointer-map entry page */
+      if( pBt->autoVacuum ){
+        do{
+          pgnoOvfl++;
+        } while( 
+          PTRMAP_ISPAGE(pBt, pgnoOvfl) || pgnoOvfl==PENDING_BYTE_PAGE(pBt) 
+        );
+        if( pgnoOvfl>1 ){
+          /* isExact = 1; */
+        }
+      }
 #endif
-      rc = allocateBtreePage(pBt, &pOvfl, &pgnoOvfl, pgnoOvfl, 0);
+      rc = allocateBtreePage(pBt, &pOvfl, &pgnoOvfl, pgnoOvfl, isExact);
 #ifndef SQLITE_OMIT_AUTOVACUUM
       /* If the database supports auto-vacuum, and the second or subsequent
       ** overflow page is being allocated, add an entry to the pointer-map
index 26557a08bd42e2d76cb054d902f37383bc0c9788..bcc621f1e2099de5e164bdfe4a0ae86471dca055 100644 (file)
@@ -12,7 +12,7 @@
 # focus of this script is testing that the overflow-page related
 # enhancements added after version 3.3.17 speed things up.
 #
-# $Id: speed3.test,v 1.1 2007/05/17 14:45:13 danielk1977 Exp $
+# $Id: speed3.test,v 1.2 2007/05/17 18:28:11 danielk1977 Exp $
 #
 
 #---------------------------------------------------------------------
@@ -97,6 +97,18 @@ proc io_log {db} {
   puts "Normal    : Read $stats2(read), wrote $stats2(write)"
 }
 
+proc overflow_report {db} {
+  set bt [btree_from_db db]
+  set csr [btree_cursor $bt 3 0]
+
+  for {btree_first $csr} {![btree_eof $csr]} {btree_next $csr} {
+    puts "[btree_ovfl_info $bt $csr]"
+  }
+
+  btree_close_cursor $csr
+  
+}
+
 proc reset_db {} {
   db close
   sqlite3 db test.db
@@ -146,6 +158,7 @@ do_test speed3-0.4 {
 # Delete all content in a table, one row at a time.
 #
 #io_log db
+#overflow_report db
 reset_db
 speed_trial speed3-1.incrvacuum $::NROW row {DELETE FROM main.t1 WHERE 1}
 speed_trial speed3-1.normal     $::NROW row {DELETE FROM aux.t1 WHERE 1}
@@ -154,8 +167,9 @@ io_log db
 # Select the "C" column (located at the far end of the overflow 
 # chain) from each table row.
 #
-db eval {PRAGMA incremental_vacuum(500000)}
+#db eval {PRAGMA incremental_vacuum(500000)}
 populate_t1 db
+#overflow_report db
 reset_db
 speed_trial speed3-2.incrvacuum $::NROW row {SELECT c FROM main.t1}
 speed_trial speed3-2.normal     $::NROW row {SELECT c FROM aux.t1}