aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2021-05-14 20:01:36 +0000
committerdrh <>2021-05-14 20:01:36 +0000
commit49bb56e9b08bae2dbee39d065aeac7caabf03081 (patch)
tree3cab6c6f2d257f129fde140decbe45c69766437a /src
parent6a9595a76be89c570de9f63bee26ec2d9f108ab6 (diff)
downloadsqlite-49bb56e9b08bae2dbee39d065aeac7caabf03081.tar.gz
sqlite-49bb56e9b08bae2dbee39d065aeac7caabf03081.zip
Small performance improvement for sqlite3BtreeInsert().
FossilOrigin-Name: 4ae64484c57740333322cebd713b50b01a5a5838d41c65f67e26d65769770789
Diffstat (limited to 'src')
-rw-r--r--src/btree.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/btree.c b/src/btree.c
index 7ee0b4eaf..e38a7c07c 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -547,7 +547,8 @@ static void invalidateIncrblobCursors(
int isClearTable /* True if all rows are being deleted */
){
BtCursor *p;
- if( pBtree->hasIncrblobCur==0 ) return;
+ // if( pBtree->hasIncrblobCur==0 ) return;
+ assert( pBtree->hasIncrblobCur );
assert( sqlite3BtreeHoldsMutex(pBtree) );
pBtree->hasIncrblobCur = 0;
for(p=pBtree->pBt->pCursor; p; p=p->pNext){
@@ -8752,7 +8753,9 @@ int sqlite3BtreeInsert(
assert( pX->pKey==0 );
/* If this is an insert into a table b-tree, invalidate any incrblob
** cursors open on the row being replaced */
- invalidateIncrblobCursors(p, pCur->pgnoRoot, pX->nKey, 0);
+ if( p->hasIncrblobCur ){
+ invalidateIncrblobCursors(p, pCur->pgnoRoot, pX->nKey, 0);
+ }
/* If BTREE_SAVEPOSITION is set, the cursor must already be pointing
** to a row with the same key as the new entry being inserted.
@@ -9179,7 +9182,7 @@ int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
/* If this is a delete operation to remove a row from a table b-tree,
** invalidate any incrblob cursors open on the row being deleted. */
- if( pCur->pKeyInfo==0 ){
+ if( pCur->pKeyInfo==0 && p->hasIncrblobCur ){
invalidateIncrblobCursors(p, pCur->pgnoRoot, pCur->info.nKey, 0);
}
@@ -9523,7 +9526,9 @@ int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){
/* Invalidate all incrblob cursors open on table iTable (assuming iTable
** is the root of a table b-tree - if it is not, the following call is
** a no-op). */
- invalidateIncrblobCursors(p, (Pgno)iTable, 0, 1);
+ if( p->hasIncrblobCur ){
+ invalidateIncrblobCursors(p, (Pgno)iTable, 0, 1);
+ }
rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange);
}
sqlite3BtreeLeave(p);