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

Experimental changes to vacuum to avoid loading large records entirely into memory. Currently only works in limited cases only - for rowid tables when the page-size does not change.

FossilOrigin-Name: c90e063ca9ddcdd1e9f1a2e25a3f7d6e7ee798373ad8acf65b90536b0a124c0d
This commit is contained in:
dan
2020-12-08 20:19:07 +00:00
parent 0dffe465f7
commit 036e0675e6
6 changed files with 142 additions and 27 deletions

View File

@@ -3572,13 +3572,6 @@ case OP_Transaction: {
&& (iMeta!=pOp->p3
|| db->aDb[pOp->p1].pSchema->iGeneration!=pOp->p4.i)
){
/*
** IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema
** version is checked to ensure that the schema has not changed since the
** SQL statement was prepared.
*/
sqlite3DbFree(db, p->zErrMsg);
p->zErrMsg = sqlite3DbStrDup(db, "database schema has changed");
/* If the schema-cookie from the database file matches the cookie
** stored with the in-memory representation of the schema, do
** not reload the schema from the database file.
@@ -3595,6 +3588,13 @@ case OP_Transaction: {
if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){
sqlite3ResetOneSchema(db, pOp->p1);
}
/*
** IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema
** version is checked to ensure that the schema has not changed since the
** SQL statement was prepared.
*/
sqlite3DbFree(db, p->zErrMsg);
p->zErrMsg = sqlite3DbStrDup(db, "database schema has changed");
p->expired = 1;
rc = SQLITE_SCHEMA;
}
@@ -5143,6 +5143,30 @@ case OP_Insert: {
break;
}
/* Opcode: Transfer P1 P2 P3 * *
** Synopsis: intkey=r[P3]
**
** P1 and P2 are both cursors open on either intkey or index btrees. This
** instruction reads the current row from P2 and writes it into the
** table opened by P1. If P1 and P2 are opened on intkey tables, register
** P3 contains the rowid value to use when inserting into P1.
*/
case OP_Transfer: {
VdbeCursor *pDest; /* Cursor to write to */
VdbeCursor *pSrc; /* Cursor to read from */
i64 iKey; /* Rowid value to insert with */
pDest = p->apCsr[pOp->p1];
pSrc = p->apCsr[pOp->p2];
iKey = aMem[pOp->p3].u.i;
rc = sqlite3BtreeTransfer(
pDest->uc.pCursor, pSrc->uc.pCursor, iKey, pDest->seekResult
);
if( rc!=SQLITE_OK ) goto abort_due_to_error;
break;
}
/* Opcode: Delete P1 P2 P3 P4 P5
**
** Delete the record at which the P1 cursor is currently pointing.