mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Use an ephemeral table rather than a RowSet to remember rowids in the
two-pass UPDATE algorithm, as this uses much less memory for large UPDATEs. FossilOrigin-Name: 842c432772e6cd8464cdb7bfdb38789adeea9aa9e0486d4034cc9841f085f517
This commit is contained in:
17
src/vdbe.c
17
src/vdbe.c
@@ -3901,7 +3901,7 @@ case OP_OpenDup: {
|
||||
}
|
||||
|
||||
|
||||
/* Opcode: OpenEphemeral P1 P2 * P4 P5
|
||||
/* Opcode: OpenEphemeral P1 P2 P3 P4 P5
|
||||
** Synopsis: nColumn=P2
|
||||
**
|
||||
** Open a new cursor P1 to a transient table.
|
||||
@@ -3921,6 +3921,10 @@ case OP_OpenDup: {
|
||||
** in btree.h. These flags control aspects of the operation of
|
||||
** the btree. The BTREE_OMIT_JOURNAL and BTREE_SINGLE flags are
|
||||
** added automatically.
|
||||
**
|
||||
** If P3 is positive, then reg[P3] is modified slightly so that it
|
||||
** can be used as zero-length data for OP_Insert. This is an optimization
|
||||
** that avoids an extra OP_Blob opcode to initialize that register.
|
||||
*/
|
||||
/* Opcode: OpenAutoindex P1 P2 * P4 *
|
||||
** Synopsis: nColumn=P2
|
||||
@@ -3943,6 +3947,15 @@ case OP_OpenEphemeral: {
|
||||
SQLITE_OPEN_TRANSIENT_DB;
|
||||
assert( pOp->p1>=0 );
|
||||
assert( pOp->p2>=0 );
|
||||
if( pOp->p3>0 ){
|
||||
/* Make register reg[P3] into a value that can be used as the data
|
||||
** form sqlite3BtreeInsert() where the length of the data is zero. */
|
||||
assert( pOp->p2==0 ); /* Only used when number of columns is zero */
|
||||
assert( pOp->opcode==OP_OpenEphemeral );
|
||||
assert( aMem[pOp->p3].flags & MEM_Null );
|
||||
aMem[pOp->p3].n = 0;
|
||||
aMem[pOp->p3].z = "";
|
||||
}
|
||||
pCx = p->apCsr[pOp->p1];
|
||||
if( pCx && pCx->pBtx ){
|
||||
/* If the ephermeral table is already open, erase all existing content
|
||||
@@ -5102,7 +5115,7 @@ case OP_Insert: {
|
||||
|
||||
if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
|
||||
if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = x.nKey;
|
||||
assert( pData->flags & (MEM_Blob|MEM_Str) );
|
||||
assert( (pData->flags & (MEM_Blob|MEM_Str))!=0 || pData->n==0 );
|
||||
x.pData = pData->z;
|
||||
x.nData = pData->n;
|
||||
seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0);
|
||||
|
Reference in New Issue
Block a user