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

Reference count the KeyInfo object. Cache a copy of an appropriate KeyInfo

for each index in the Index object, and reuse that one copy as much as possible.

FossilOrigin-Name: defd5205a7cc3543cdd18f906f568e943b8b3a2c
This commit is contained in:
drh
2013-11-06 19:59:23 +00:00
parent 93889d9335
commit 2ec2fb2269
16 changed files with 175 additions and 161 deletions

View File

@@ -360,9 +360,8 @@ void sqlite3Update(
pParse->nMem += nPk;
regKey = ++pParse->nMem;
iEph = pParse->nTab++;
sqlite3VdbeAddOp4(v, OP_OpenEphemeral, iEph, nPk, 0,
(char*)sqlite3IndexKeyinfo(pParse, pPk),
P4_KEYINFO_HANDOFF);
sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEph, nPk);
sqlite3VdbeSetP4KeyInfo(pParse, pPk);
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, 0, 0);
if( pWInfo==0 ) goto update_cleanup;
for(i=0; i<nPk; i++){
@@ -408,9 +407,8 @@ void sqlite3Update(
for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
assert( aRegIdx );
if( openAll || aRegIdx[i]>0 ){
KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIdx);
sqlite3VdbeAddOp4(v, OP_OpenWrite, iIdxCur+i, pIdx->tnum, iDb,
(char*)pKey, P4_KEYINFO_HANDOFF);
sqlite3VdbeAddOp3(v, OP_OpenWrite, iIdxCur+i, pIdx->tnum, iDb);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
assert( pParse->nTab>iIdxCur+i );
VdbeComment((v, "%s", pIdx->zName));
}