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

Sorting is now done using a sorting index rather than loading the entire

result set into memory and doing a merge sort.  The old merge sort technique
was a carry-over from SQLite version 1.  The new method uses a bounded amount
of memory and scales to much larger result sets.  There are still errors:
some 39 regression tests fail. (CVS 2653)

FossilOrigin-Name: 09db0a24241f9248584250d1728117b8a3159626
This commit is contained in:
drh
2005-09-01 03:07:44 +00:00
parent dece1a8464
commit 0342b1f542
9 changed files with 192 additions and 338 deletions

View File

@@ -125,23 +125,6 @@ struct Mem {
};
typedef struct Mem Mem;
/*
** A sorter builds a list of elements to be sorted. Each element of
** the list is an instance of the following structure.
*/
typedef struct Sorter Sorter;
struct Sorter {
int nKey; /* Number of bytes in the key */
char *zKey; /* The key by which we will sort */
Mem data;
Sorter *pNext; /* Next in the list */
};
/*
** Number of buckets used for merge-sort.
*/
#define NSORT 30
/* One or more of the following flags are set to indicate the validOK
** representations of the value stored in the Mem struct.
**
@@ -324,8 +307,6 @@ struct Vdbe {
Mem *aColName; /* Column names to return */
int nCursor; /* Number of slots in apCsr[] */
Cursor **apCsr; /* One element of this array for each open cursor */
Sorter *pSort; /* A linked list of objects to be sorted */
Sorter *pSortTail; /* Last element on the pSort list */
int nVar; /* Number of entries in aVar[] */
Mem *aVar; /* Values for the OP_Variable opcode. */
char **azVar; /* Name of variables */
@@ -373,7 +354,6 @@ struct Vdbe {
** Function prototypes
*/
void sqlite3VdbeFreeCursor(Cursor*);
void sqlite3VdbeSorterReset(Vdbe*);
int sqlite3VdbeAggReset(sqlite3*, Agg *, KeyInfo *);
void sqliteVdbePopStack(Vdbe*,int);
int sqlite3VdbeCursorMoveto(Cursor*);