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

Defer the {quote: MoveTo}

opcode in VDBE until the data is actually needed.  Sometimes
the data is never needed, resulting in a performance increase.  On an indexed
order search with a large OFFSET, queries times can be an order of magnitude
faster. (CVS 1165)

FossilOrigin-Name: d3e96da20d269a068188915b3cc0eb02d330d316
This commit is contained in:
drh
2004-01-07 18:52:56 +00:00
parent 912184b0cf
commit a11846b77a
5 changed files with 98 additions and 49 deletions

View File

@@ -16,6 +16,15 @@
** this header information was factored out.
*/
/*
** When converting from the native format to the key format and back
** again, in addition to changing the byte order we invert the high-order
** bit of the most significant byte. This causes negative numbers to
** sort before positive numbers in the memcmp() function.
*/
#define keyToInt(X) (sqliteVdbeByteSwap(X) ^ 0x80000000)
#define intToKey(X) (sqliteVdbeByteSwap((X) ^ 0x80000000))
/*
** The makefile scans this source file and creates the following
** array of string constants which are the names of all VDBE opcodes.
@@ -62,6 +71,8 @@ struct Cursor {
Bool nullRow; /* True if pointing to a row with no data */
Bool nextRowidValid; /* True if the nextRowid field is valid */
Bool pseudoTable; /* This is a NEW or OLD pseudo-tables of a trigger */
Bool deferredMoveto; /* A call to sqliteBtreeMoveto() is needed */
int movetoTarget; /* Argument to the deferred sqliteBtreeMoveto() */
Btree *pBt; /* Separate file holding temporary table */
int nData; /* Number of bytes in pData */
char *pData; /* Data for a NEW or OLD pseudo-table */
@@ -294,6 +305,8 @@ void sqliteVdbeSorterReset(Vdbe*);
void sqliteVdbeAggReset(Agg*);
void sqliteVdbeKeylistFree(Keylist*);
void sqliteVdbePopStack(Vdbe*,int);
int sqliteVdbeCursorMoveto(Cursor*);
int sqliteVdbeByteSwap(int);
#if !defined(NDEBUG) || defined(VDBE_PROFILE)
void sqliteVdbePrintOp(FILE*, int, Op*);
#endif