1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Enhance the Btree object to remember whether or not it is holding an

Incrblob cursor.  Use this knowledge to improve performance in the common
case where it does not.

FossilOrigin-Name: 476b11563c08c6d9c0abd69e4d865c4edcdd45f5
This commit is contained in:
drh
2015-06-25 13:03:10 +00:00
parent 526b17db13
commit 6918095d81
4 changed files with 18 additions and 14 deletions

View File

@@ -490,13 +490,15 @@ static void invalidateIncrblobCursors(
int isClearTable /* True if all rows are being deleted */
){
BtCursor *p;
BtShared *pBt = pBtree->pBt;
if( pBtree->hasIncrblobCur==0 ) return;
assert( sqlite3BtreeHoldsMutex(pBtree) );
for(p=pBt->pCursor; p; p=p->pNext){
if( (p->curFlags & BTCF_Incrblob)!=0
&& (isClearTable || p->info.nKey==iRow)
){
p->eState = CURSOR_INVALID;
pBtree->hasIncrblobCur = 0;
for(p=pBtree->pBt->pCursor; p; p=p->pNext){
if( (p->curFlags & BTCF_Incrblob)!=0 ){
pBtree->hasIncrblobCur = 1;
if( isClearTable || p->info.nKey==iRow ){
p->eState = CURSOR_INVALID;
}
}
}
}
@@ -9450,6 +9452,7 @@ int sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void *z){
*/
void sqlite3BtreeIncrblobCursor(BtCursor *pCur){
pCur->curFlags |= BTCF_Incrblob;
pCur->pBtree->hasIncrblobCur = 1;
}
#endif