aboutsummaryrefslogtreecommitdiff
path: root/src/build.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2012-08-06 18:50:11 +0000
committerdan <dan@noemail.net>2012-08-06 18:50:11 +0000
commit428c218c90cce7bbff210a19ee01ecdc01511076 (patch)
tree70a786e7696405b715daf18df4c858e25427a467 /src/build.c
parent8c5287ec73659e982e593c339b92e6ea2f5ff3d1 (diff)
downloadsqlite-428c218c90cce7bbff210a19ee01ecdc01511076.tar.gz
sqlite-428c218c90cce7bbff210a19ee01ecdc01511076.zip
When reusing pages as part of creating a new index, allocate the leaves from each free-list trunk page in ascending order, instead of trying to maximize localization for each individual allocation. This increases the chance that pages will be written to disk in ascending order by a large CREATE INDEX statement, improving overall performance.
FossilOrigin-Name: d045f8b2d44e388d8c4549ff02d4ca7eff4e2038
Diffstat (limited to 'src/build.c')
-rw-r--r--src/build.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/build.c b/src/build.c
index 9f13b7b11..776ffa4db 100644
--- a/src/build.c
+++ b/src/build.c
@@ -1581,7 +1581,7 @@ void sqlite3EndTable(
assert(pParse->nTab==1);
sqlite3VdbeAddOp3(v, OP_OpenWrite, 1, pParse->regRoot, iDb);
- sqlite3VdbeChangeP5(v, 1);
+ sqlite3VdbeChangeP5(v, OPFLAG_P2ISREG);
pParse->nTab = 2;
sqlite3SelectDestInit(&dest, SRT_Table, 1);
sqlite3Select(pParse, pSelect, &dest);
@@ -2397,9 +2397,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
pKey = sqlite3IndexKeyinfo(pParse, pIndex);
sqlite3VdbeAddOp4(v, OP_OpenWrite, iIdx, tnum, iDb,
(char *)pKey, P4_KEYINFO_HANDOFF);
- if( memRootPage>=0 ){
- sqlite3VdbeChangeP5(v, 1);
- }
+ sqlite3VdbeChangeP5(v, OPFLAG_BULKCSR|((memRootPage>=0)?OPFLAG_P2ISREG:0));
#ifndef SQLITE_OMIT_MERGE_SORT
/* Open the sorter cursor if we are to use one. */