1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

When doing a REPLACE on a WITHOUT ROWID table with no secondary indexes,

bypass the OP_NoConflict/OP_Delete sequence and directly overwrite any
preexisting row, for a performance increase.

FossilOrigin-Name: f7041cbb63b912f9ecad538804b6f2383efbec4e
This commit is contained in:
drh
2016-11-10 17:01:36 +00:00
parent bf2f5739c9
commit c6c9e158c5
3 changed files with 15 additions and 8 deletions

View File

@@ -1560,6 +1560,12 @@ void sqlite3GenerateConstraintChecks(
}else if( onError==OE_Default ){
onError = OE_Abort;
}
if( ix==0 && pPk==pIdx && onError==OE_Replace && pPk->pNext==0 ){
sqlite3VdbeResolveLabel(v, addrUniqueOk);
continue;
}
/* Check to see if the new index entry will be unique */
sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
@@ -1700,7 +1706,8 @@ void sqlite3CompleteInsertion(
VdbeCoverage(v);
}
sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
aRegIdx[i]+1, pIdx->nColumn);
aRegIdx[i]+1,
pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn);
pik_flags = 0;
if( useSeekResult ) pik_flags = OPFLAG_USESEEKRESULT;
if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){