mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
B-tree optimization: When seeking on a rowid table that has already been
positioned, check to see if the new row happens to be the next row on the same leaf page. That is a reasonably common case, and if it is true it avoids a full binary search. FossilOrigin-Name: 8e5cfb2039126da7689c4b1c88760f10e1234eaf
This commit is contained in:
18
src/btree.c
18
src/btree.c
@@ -5091,9 +5091,21 @@ int sqlite3BtreeMovetoUnpacked(
|
||||
*pRes = 0;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
if( (pCur->curFlags & BTCF_AtLast)!=0 && pCur->info.nKey<intKey ){
|
||||
*pRes = -1;
|
||||
return SQLITE_OK;
|
||||
if( pCur->info.nKey<intKey ){
|
||||
if( (pCur->curFlags & BTCF_AtLast)!=0 ){
|
||||
*pRes = -1;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
if( pCur->aiIdx[pCur->iPage]+1<pCur->apPage[pCur->iPage]->nCell ){
|
||||
pCur->aiIdx[pCur->iPage]++;
|
||||
pCur->info.nSize = 0;
|
||||
pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
|
||||
getCellInfo(pCur);
|
||||
if( pCur->info.nKey==intKey ){
|
||||
*pRes = 0;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user