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

Avoid some unnecessary OP_SCopy operations when inserting into a table

with multiple indices.

FossilOrigin-Name: 429018b19cb525a4bb0843d20955457b53900d4b
This commit is contained in:
drh
2014-01-03 16:03:43 +00:00
parent 759e858811
commit 5426d80948
3 changed files with 10 additions and 7 deletions

View File

@@ -1233,6 +1233,7 @@ void sqlite3GenerateConstraintChecks(
int ipkTop = 0; /* Top of the rowid change constraint check */
int ipkBottom = 0; /* Bottom of the rowid change constraint check */
u8 isUpdate; /* True if this is an UPDATE operation */
int regRowid = -1; /* Register holding ROWID value */
isUpdate = regOldData!=0;
db = pParse->db;
@@ -1463,7 +1464,9 @@ void sqlite3GenerateConstraintChecks(
int iField = pIdx->aiColumn[i];
int x;
if( iField<0 || iField==pTab->iPKey ){
if( regRowid==regIdx+i ) continue; /* ROWID already in regIdx+i */
x = regNewData;
regRowid = pIdx->pPartIdxWhere ? -1 : regIdx+i;
}else{
x = iField + regNewData + 1;
}