Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Remove the VDBE merge sorter. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
1073bb477eb101ebeedb935b1db33d80 |
User & Date: | drh 2012-04-23 14:26:35.355 |
Context
2012-04-23
| ||
14:54 | Fix a bug in the nocase collation xMkKey function. check-in: fe9ccd646d user: dan tags: trunk | |
14:26 | Remove the VDBE merge sorter. check-in: 1073bb477e user: drh tags: trunk | |
14:11 | Add an xMkKey callback to the built-in collation sequence "nocase". Fix a bug in encoding text values with collation sequences into database keys. check-in: 6c9adc9acc user: dan tags: trunk | |
Changes
Changes to main.mk.
︙ | ︙ | |||
61 62 63 64 65 66 67 | mutex.o mutex_noop.o mutex_os2.o mutex_unix.o mutex_w32.o \ opcodes.o os.o os_os2.o os_unix.o os_win.o \ parse.o pragma.o prepare.o printf.o \ random.o resolve.o rowset.o rtree.o select.o status.o storage.o \ tokenize.o trigger.o \ update.o util.o varint.o \ vdbe.o vdbeapi.o vdbeaux.o vdbecodec.o vdbecursor.o \ | | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | mutex.o mutex_noop.o mutex_os2.o mutex_unix.o mutex_w32.o \ opcodes.o os.o os_os2.o os_unix.o os_win.o \ parse.o pragma.o prepare.o printf.o \ random.o resolve.o rowset.o rtree.o select.o status.o storage.o \ tokenize.o trigger.o \ update.o util.o varint.o \ vdbe.o vdbeapi.o vdbeaux.o vdbecodec.o vdbecursor.o \ vdbemem.o vdbetrace.o \ walker.o where.o utf.o vtab.o # All of the source code files. # SRC = \ |
︙ | ︙ | |||
139 140 141 142 143 144 145 | $(TOP)/src/util.c \ $(TOP)/src/varint.c \ $(TOP)/src/vdbe.c \ $(TOP)/src/vdbe.h \ $(TOP)/src/vdbeapi.c \ $(TOP)/src/vdbeaux.c \ $(TOP)/src/vdbemem.c \ | < | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | $(TOP)/src/util.c \ $(TOP)/src/varint.c \ $(TOP)/src/vdbe.c \ $(TOP)/src/vdbe.h \ $(TOP)/src/vdbeapi.c \ $(TOP)/src/vdbeaux.c \ $(TOP)/src/vdbemem.c \ $(TOP)/src/vdbetrace.c \ $(TOP)/src/vdbeInt.h \ $(TOP)/src/vtab.c \ $(TOP)/src/walker.c \ $(TOP)/src/where.c # Source code for extensions |
︙ | ︙ |
Changes to src/ctime.c.
︙ | ︙ | |||
253 254 255 256 257 258 259 | #endif #ifdef SQLITE_OMIT_LOOKASIDE "OMIT_LOOKASIDE", #endif #ifdef SQLITE_OMIT_MEMORYDB "OMIT_MEMORYDB", #endif | < < < | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | #endif #ifdef SQLITE_OMIT_LOOKASIDE "OMIT_LOOKASIDE", #endif #ifdef SQLITE_OMIT_MEMORYDB "OMIT_MEMORYDB", #endif #ifdef SQLITE_OMIT_OR_OPTIMIZATION "OMIT_OR_OPTIMIZATION", #endif #ifdef SQLITE_OMIT_PAGER_PRAGMAS "OMIT_PAGER_PRAGMAS", #endif #ifdef SQLITE_OMIT_PRAGMA |
︙ | ︙ |
Changes to src/sqliteInt.h.
︙ | ︙ | |||
18 19 20 21 22 23 24 | /*#define SQLITE_OMIT_BTREECOUNT 1*/ #define SQLITE_OMIT_WAL 1 #define SQLITE_OMIT_VACUUM 1 #define SQLITE_OMIT_AUTOVACUUM 1 /*#define SQLITE_OMIT_PAGER_PRAGMAS 1*/ #define SQLITE_OMIT_PROGRESS_CALLBACK 1 | < < | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | /*#define SQLITE_OMIT_BTREECOUNT 1*/ #define SQLITE_OMIT_WAL 1 #define SQLITE_OMIT_VACUUM 1 #define SQLITE_OMIT_AUTOVACUUM 1 /*#define SQLITE_OMIT_PAGER_PRAGMAS 1*/ #define SQLITE_OMIT_PROGRESS_CALLBACK 1 /* ** These #defines should enable >2GB file support on POSIX if the ** underlying operating system supports it. If the OS lacks ** large file support, or if the OS is windows, these should be no-ops. ** ** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any ** system #includes. Hence, this block of code must be the very first |
︙ | ︙ |
Changes to src/test_config.c.
︙ | ︙ | |||
367 368 369 370 371 372 373 | #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY); #else Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY); #endif | < < < < < < | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY); #else Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY); #endif #ifdef SQLITE_OMIT_OR_OPTIMIZATION Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY); #else Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY); #endif #ifdef SQLITE_OMIT_PAGER_PRAGMAS |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
147 148 149 150 151 152 153 | ** string that the register itself controls. In other words, it ** converts an MEM_Ephem string into an MEM_Dyn string. */ #define Deephemeralize(P) \ if( ((P)->flags&MEM_Ephem)!=0 \ && sqlite4VdbeMemMakeWriteable(P) ){ goto no_mem;} | < < < < < < < | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | ** string that the register itself controls. In other words, it ** converts an MEM_Ephem string into an MEM_Dyn string. */ #define Deephemeralize(P) \ if( ((P)->flags&MEM_Ephem)!=0 \ && sqlite4VdbeMemMakeWriteable(P) ){ goto no_mem;} /* ** Argument pMem points at a register that will be passed to a ** user-defined function or returned to the user as the result of a query. ** This routine sets the pMem->type variable used by the sqlite4_value_*() ** routines. */ void sqlite4VdbeMemStoreType(Mem *pMem){ |
︙ | ︙ | |||
2757 2758 2759 2760 2761 2762 2763 | ** ** This opcode works like OP_OpenEphemeral except that it opens ** a transient index that is specifically designed to sort large ** tables using an external merge-sort algorithm. */ case OP_SorterOpen: { /* VdbeCursor *pCx; */ | < < < < < < < < < | 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 | ** ** This opcode works like OP_OpenEphemeral except that it opens ** a transient index that is specifically designed to sort large ** tables using an external merge-sort algorithm. */ case OP_SorterOpen: { /* VdbeCursor *pCx; */ pOp->opcode = OP_OpenEphemeral; pc--; break; } /* Opcode: OpenPseudo P1 P2 P3 * * ** ** Open a new cursor that points to a fake table that contains a single ** row of data. The content of that one row is the content of memory |
︙ | ︙ | |||
3412 3413 3414 3415 3416 3417 3418 | */ case OP_ResetCount: { sqlite4VdbeSetChanges(db, p->nChange); p->nChange = 0; break; } | < < < < < < < < < < < < < < < < < < < < < < | 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 | */ case OP_ResetCount: { sqlite4VdbeSetChanges(db, p->nChange); p->nChange = 0; break; } /* Opcode: GrpCompare P1 P2 P3 ** ** P1 is a cursor used to sort records. Its keys consist of the fields being ** sorted on encoded as an ordinary database key, followed by a sequence ** number encoded as defined by the comments surrounding OP_MakeIdxKey. ** Register P3 either contains NULL, or such a key truncated so as to ** remove the sequence number. |
︙ | ︙ | |||
3480 3481 3482 3483 3484 3485 3486 | ** Write into register P2 the current sorter data for sorter cursor P1. */ case OP_SorterData: { VdbeCursor *pC; pOut = &aMem[pOp->p2]; pC = p->apCsr[pOp->p1]; assert( pC!=0 ); | < < < < < | 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 | ** Write into register P2 the current sorter data for sorter cursor P1. */ case OP_SorterData: { VdbeCursor *pC; pOut = &aMem[pOp->p2]; pC = p->apCsr[pOp->p1]; assert( pC!=0 ); pOp->opcode = OP_RowData; pc--; break; } /* Opcode: RowData P1 P2 * * * ** ** Write into register P2 the complete row data for cursor P1. ** There is no interpretation of the data. |
︙ | ︙ | |||
3523 3524 3525 3526 3527 3528 3529 | pOut = &aMem[pOp->p2]; memAboutToChange(p, pOut); /* Note that RowKey and RowData are really exactly the same instruction */ assert( pOp->p1>=0 && pOp->p1<p->nCursor ); pC = p->apCsr[pOp->p1]; | < < | 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 | pOut = &aMem[pOp->p2]; memAboutToChange(p, pOut); /* Note that RowKey and RowData are really exactly the same instruction */ assert( pOp->p1>=0 && pOp->p1<p->nCursor ); pC = p->apCsr[pOp->p1]; assert( pC!=0 ); assert( pC->nullRow==0 ); assert( pC->pseudoTableReg==0 ); assert( pC->pKVCur!=0 ); pCrsr = pC->pKVCur; if( pOp->opcode==OP_RowKey ){ rc = sqlite4KVCursorKey(pCrsr, &pData, &nData); }else{ rc = sqlite4KVCursorData(pCrsr, 0, -1, &pData, &nData); |
︙ | ︙ | |||
3645 3646 3647 3648 3649 3650 3651 | ** then rewinding that index and playing it back from beginning to ** end. We use the OP_Sort opcode instead of OP_Rewind to do the ** rewinding so that the global variable will be incremented and ** regression tests can determine whether or not the optimizer is ** correctly optimizing out sorts. */ case OP_SorterSort: /* jump */ | < < | 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 | ** then rewinding that index and playing it back from beginning to ** end. We use the OP_Sort opcode instead of OP_Rewind to do the ** rewinding so that the global variable will be incremented and ** regression tests can determine whether or not the optimizer is ** correctly optimizing out sorts. */ case OP_SorterSort: /* jump */ pOp->opcode = OP_Sort; case OP_Sort: { /* jump */ #ifdef SQLITE_TEST sqlite4_sort_count++; sqlite4_search_count--; #endif p->aCounter[SQLITE_STMTSTATUS_SORT-1]++; /* Fall through into OP_Rewind */ |
︙ | ︙ | |||
3671 3672 3673 3674 3675 3676 3677 | case OP_Rewind: { /* jump */ VdbeCursor *pC; int doJump; assert( pOp->p1>=0 && pOp->p1<p->nCursor ); pC = p->apCsr[pOp->p1]; assert( pC!=0 ); | < < < < | | | | | | < | 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 | case OP_Rewind: { /* jump */ VdbeCursor *pC; int doJump; assert( pOp->p1>=0 && pOp->p1<p->nCursor ); pC = p->apCsr[pOp->p1]; assert( pC!=0 ); doJump = 1; rc = sqlite4VdbeSeekEnd(pC, +1); if( rc==SQLITE_NOTFOUND ){ rc = SQLITE_OK; doJump = 1; }else{ doJump = 0; } pC->nullRow = (u8)doJump; assert( pOp->p2>0 && pOp->p2<p->nOp ); if( doJump ){ pc = pOp->p2 - 1; } break; |
︙ | ︙ | |||
3725 3726 3727 3728 3729 3730 3731 | ** P4 is always of type P4_ADVANCE. The function pointer points to ** sqlite4VdbePrevious(). ** ** If P5 is positive and the jump is taken, then event counter ** number P5-1 in the prepared statement is incremented. */ case OP_SorterNext: /* jump */ | < < < < < < < < | | | | < > < < < < < < < < < < < < < < < < < < < < > | 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 | ** P4 is always of type P4_ADVANCE. The function pointer points to ** sqlite4VdbePrevious(). ** ** If P5 is positive and the jump is taken, then event counter ** number P5-1 in the prepared statement is incremented. */ case OP_SorterNext: /* jump */ pOp->opcode = OP_Next; case OP_Prev: /* jump */ case OP_Next: { /* jump */ VdbeCursor *pC; int res; CHECK_FOR_INTERRUPT; assert( pOp->p1>=0 && pOp->p1<p->nCursor ); assert( pOp->p5<=ArraySize(p->aCounter) ); pC = p->apCsr[pOp->p1]; if( pC==0 ){ break; /* See ticket #2273 */ } res = 1; assert( pOp->opcode!=OP_Next || pOp->p4.xAdvance==sqlite4VdbeNext ); assert( pOp->opcode!=OP_Prev || pOp->p4.xAdvance==sqlite4VdbePrevious ); rc = pOp->p4.xAdvance(pC); if( rc==SQLITE_OK ){ pc = pOp->p2 - 1; if( pOp->p5 ) p->aCounter[pOp->p5-1]++; pC->nullRow = 0; #ifdef SQLITE_TEST sqlite4_search_count++; #endif }else if( rc==SQLITE_NOTFOUND ){ pC->nullRow = 1; rc = SQLITE_OK; } pC->rowidIsValid = 0; break; } /* Opcode: SorterInsert P1 P2 P3 */ /* Opcode: IdxInsert P1 P2 P3 * P5 ** ** Register P3 holds the key and register P2 holds the data for an ** index entry. Write this record into the index specified by the ** cursor P1. */ case OP_SorterInsert: /* in2 */ case OP_IdxInsert: { VdbeCursor *pC; Mem *pKey; Mem *pData; pC = p->apCsr[pOp->p1]; pKey = &aMem[pOp->p3]; |
︙ | ︙ |
Changes to src/vdbeInt.h.
︙ | ︙ | |||
61 62 63 64 65 66 67 | Bool rowidIsValid; /* True if lastRowid is valid */ Bool atFirst; /* True if pointing to first entry */ Bool useRandomRowid; /* Generate new record numbers semi-randomly */ Bool nullRow; /* True if pointing to a row with no data */ Bool isTable; /* True if a table requiring integer keys */ Bool isIndex; /* True if an index containing keys only - no data */ Bool isOrdered; /* True if the underlying table is BTREE_UNORDERED */ | < | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | Bool rowidIsValid; /* True if lastRowid is valid */ Bool atFirst; /* True if pointing to first entry */ Bool useRandomRowid; /* Generate new record numbers semi-randomly */ Bool nullRow; /* True if pointing to a row with no data */ Bool isTable; /* True if a table requiring integer keys */ Bool isIndex; /* True if an index containing keys only - no data */ Bool isOrdered; /* True if the underlying table is BTREE_UNORDERED */ sqlite4_vtab_cursor *pVtabCursor; /* The cursor for a virtual table */ const sqlite4_module *pModule; /* Module for cursor pVtabCursor */ i64 seqCount; /* Sequence counter */ i64 movetoTarget; /* Argument to the deferred move-to */ i64 lastRowid; /* Last rowid from a Next or NextIdx operation */ VdbeSorter *pSorter; /* Sorter object for OP_SorterOpen cursors */ |
︙ | ︙ | |||
432 433 434 435 436 437 438 | int sqlite4VdbeFrameRestore(VdbeFrame *); void sqlite4VdbeMemStoreType(Mem *pMem); int sqlite4VdbeTransferError(Vdbe *p); int sqlite4VdbeSeekEnd(VdbeCursor*, int); int sqlite4VdbeNext(VdbeCursor*); int sqlite4VdbePrevious(VdbeCursor*); | < < < < < < < < < < < < < < < < < < | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | int sqlite4VdbeFrameRestore(VdbeFrame *); void sqlite4VdbeMemStoreType(Mem *pMem); int sqlite4VdbeTransferError(Vdbe *p); int sqlite4VdbeSeekEnd(VdbeCursor*, int); int sqlite4VdbeNext(VdbeCursor*); int sqlite4VdbePrevious(VdbeCursor*); #ifdef SQLITE_DEBUG void sqlite4VdbeMemAboutToChange(Vdbe*,Mem*); #endif #ifndef SQLITE_OMIT_FOREIGN_KEY int sqlite4VdbeCheckFk(Vdbe *, int); #else |
︙ | ︙ |
Changes to src/vdbeaux.c.
︙ | ︙ | |||
1493 1494 1495 1496 1497 1498 1499 | ** Close a VDBE cursor and release all the resources that cursor ** happens to hold. */ void sqlite4VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){ if( pCx==0 ){ return; } | < | 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | ** Close a VDBE cursor and release all the resources that cursor ** happens to hold. */ void sqlite4VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){ if( pCx==0 ){ return; } if( pCx->pKVCur ){ sqlite4KVCursorClose(pCx->pKVCur); } if( pCx->pTmpKV ){ sqlite4KVStoreClose(pCx->pTmpKV); } #ifndef SQLITE_OMIT_VIRTUALTABLE |
︙ | ︙ |
Deleted src/vdbesort.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |