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

Activate the cell-overwrite optimization for index b-trees.

FossilOrigin-Name: a68697d10ef17d452c8279181186faad7bc54e3a35858a336552f717449065ea
This commit is contained in:
drh
2018-05-07 18:41:19 +00:00
parent d720d394d0
commit 89ee229810
4 changed files with 42 additions and 11 deletions

View File

@@ -8396,6 +8396,22 @@ int sqlite3BtreeInsert(
}
if( rc ) return rc;
}
/* If the cursor is currently pointing to an entry to be overwritten
** and the new content is the same as as the old, then use the
** overwrite optimization.
*/
if( loc==0 ){
getCellInfo(pCur);
if( pCur->info.nKey==pX->nKey ){
BtreePayload x2;
x2.pData = pX->pKey;
x2.nData = pX->nKey;
x2.nZero = 0;
return btreeOverwriteCell(pCur, &x2);
}
}
}
assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) );