1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Change the way overflow pages are allocated from the free-list to increase the chance that they are a contiguous block. Much more can still be done. (CVS 4023)

FossilOrigin-Name: b7391892041eb72b0ebcbb7a9a6721ae3482dd80
This commit is contained in:
danielk1977
2007-05-17 18:28:11 +00:00
parent 6338c762a5
commit b39f70b04a
4 changed files with 37 additions and 12 deletions

View File

@ -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) 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-17T16:38:30 D 2007-05-17T18:28:11
F Makefile.in a42354804b50c2708ce72cf79e4daa30f50191b5 F Makefile.in a42354804b50c2708ce72cf79e4daa30f50191b5
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -61,7 +61,7 @@ F src/alter.c 1b1deeb97446ed87f2fa17a3eb6236548841a348
F src/analyze.c e8fcb1c35ace8418615eb18d9601f321ac86b2ec F src/analyze.c e8fcb1c35ace8418615eb18d9601f321ac86b2ec
F src/attach.c ba628db0c2b6a362f036d017bf1196cdfe4ebb37 F src/attach.c ba628db0c2b6a362f036d017bf1196cdfe4ebb37
F src/auth.c 5ea90bc93dfea46e9fe4bf531e14c7cd98219ecb F src/auth.c 5ea90bc93dfea46e9fe4bf531e14c7cd98219ecb
F src/btree.c 911798b91bbad31a033ed501b95c76df8541874b F src/btree.c 9179039d9a023da986c168e276680fed9dcc57fd
F src/btree.h 1d527bf61ed176f980c34999d5793a0fd45dcf8c F src/btree.h 1d527bf61ed176f980c34999d5793a0fd45dcf8c
F src/btreeInt.h f92c0577f49d961c0148b477a25647e8fd80eecf F src/btreeInt.h f92c0577f49d961c0148b477a25647e8fd80eecf
F src/build.c 50992d92e131a9aa9aa6657fb1ddc13e176fd70c F src/build.c 50992d92e131a9aa9aa6657fb1ddc13e176fd70c
@ -345,7 +345,7 @@ F test/shared_err.test cc528f6e78665787e93d9ce3a782a2ce5179d821
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5 F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
F test/speed1.test 22e1b27af0683ed44dcd2f93ed817a9c3e65084a F test/speed1.test 22e1b27af0683ed44dcd2f93ed817a9c3e65084a
F test/speed2.test 53177056baf6556dcbdcf032bbdfc41c1aa74ded F test/speed2.test 53177056baf6556dcbdcf032bbdfc41c1aa74ded
F test/speed3.test 2c1947ad95b0d5cbd41a485c62402911ef9fd541 F test/speed3.test 27a71b5cc83c1f23baf6d0ee52e2f195e3c415f2
F test/sqllimits1.test b15a5784e47199d68fa1182157ba7e790f467d9f F test/sqllimits1.test b15a5784e47199d68fa1182157ba7e790f467d9f
F test/subquery.test ae324ee928c5fb463a3ce08a8860d6e7f1ca5797 F test/subquery.test ae324ee928c5fb463a3ce08a8860d6e7f1ca5797
F test/subselect.test 974e87f8fc91c5f00dd565316d396a5a6c3106c4 F test/subselect.test 974e87f8fc91c5f00dd565316d396a5a6c3106c4
@ -493,7 +493,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P f2ce727c4d798c666e95876a2b67e8a305d82e3a P ae644bc7aad229f2d219ea20eb4774318feb3051
R 7b00490089c9a9acc3bbd9b31f5ea738 R 269f6950d9247c5d127e8dd163a6acb5
U danielk1977 U danielk1977
Z 3e6e530a34bc48403e48b023fcadb804 Z 028a3648b2f6bed3a2edcff1de5c489f

View File

@ -1 +1 @@
ae644bc7aad229f2d219ea20eb4774318feb3051 b7391892041eb72b0ebcbb7a9a6721ae3482dd80

View File

@ -9,7 +9,7 @@
** May you share freely, never taking more than you give. ** 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. ** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information. ** See the header comment on "btreeInt.h" for additional information.
@ -3843,10 +3843,21 @@ static int fillInCell(
while( nPayload>0 ){ while( nPayload>0 ){
if( spaceLeft==0 ){ if( spaceLeft==0 ){
int isExact = 0;
#ifndef SQLITE_OMIT_AUTOVACUUM #ifndef SQLITE_OMIT_AUTOVACUUM
Pgno pgnoPtrmap = pgnoOvfl; /* Overflow page pointer-map entry page */ 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 #endif
rc = allocateBtreePage(pBt, &pOvfl, &pgnoOvfl, pgnoOvfl, 0); rc = allocateBtreePage(pBt, &pOvfl, &pgnoOvfl, pgnoOvfl, isExact);
#ifndef SQLITE_OMIT_AUTOVACUUM #ifndef SQLITE_OMIT_AUTOVACUUM
/* If the database supports auto-vacuum, and the second or subsequent /* If the database supports auto-vacuum, and the second or subsequent
** overflow page is being allocated, add an entry to the pointer-map ** overflow page is being allocated, add an entry to the pointer-map

View File

@ -12,7 +12,7 @@
# focus of this script is testing that the overflow-page related # focus of this script is testing that the overflow-page related
# enhancements added after version 3.3.17 speed things up. # 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)" 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 {} { proc reset_db {} {
db close db close
sqlite3 db test.db sqlite3 db test.db
@ -146,6 +158,7 @@ do_test speed3-0.4 {
# Delete all content in a table, one row at a time. # Delete all content in a table, one row at a time.
# #
#io_log db #io_log db
#overflow_report db
reset_db reset_db
speed_trial speed3-1.incrvacuum $::NROW row {DELETE FROM main.t1 WHERE 1} 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} 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 # Select the "C" column (located at the far end of the overflow
# chain) from each table row. # chain) from each table row.
# #
db eval {PRAGMA incremental_vacuum(500000)} #db eval {PRAGMA incremental_vacuum(500000)}
populate_t1 db populate_t1 db
#overflow_report db
reset_db reset_db
speed_trial speed3-2.incrvacuum $::NROW row {SELECT c FROM main.t1} speed_trial speed3-2.incrvacuum $::NROW row {SELECT c FROM main.t1}
speed_trial speed3-2.normal $::NROW row {SELECT c FROM aux.t1} speed_trial speed3-2.normal $::NROW row {SELECT c FROM aux.t1}