Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Use OP_Sort rather than OP_Rewind in order to sort the content of a new index on the CREATE INDEX statement. Add an ALWAYS() to the merge sort logic to document an unreachable branch. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f01766f42342f043bf0cbe1e07224963 |
User & Date: | drh 2011-08-17 00:40:58.276 |
Context
2011-08-17
| ||
02:19 | Add vdbesort.c to the MSVC makefile. (check-in: 8eaa2cd3f4 user: mistachkin tags: trunk) | |
00:40 | Use OP_Sort rather than OP_Rewind in order to sort the content of a new index on the CREATE INDEX statement. Add an ALWAYS() to the merge sort logic to document an unreachable branch. (check-in: f01766f423 user: drh tags: trunk) | |
2011-08-15
| ||
19:44 | Updated comments on the multiplexor extension. No changes to code. (check-in: 0f42ef697e user: drh tags: trunk) | |
Changes
Changes to src/build.c.
︙ | ︙ | |||
2381 2382 2383 2384 2385 2386 2387 | regRecord = sqlite3GetTempReg(pParse); regIdxKey = sqlite3GenerateIndexKey(pParse, pIndex, iTab, regRecord, 1); if( bUseSorter ){ sqlite3VdbeAddOp2(v, OP_IdxInsert, iSorter, regRecord); sqlite3VdbeAddOp2(v, OP_Next, iTab, addr1+1); sqlite3VdbeJumpHere(v, addr1); | | | 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 | regRecord = sqlite3GetTempReg(pParse); regIdxKey = sqlite3GenerateIndexKey(pParse, pIndex, iTab, regRecord, 1); if( bUseSorter ){ sqlite3VdbeAddOp2(v, OP_IdxInsert, iSorter, regRecord); sqlite3VdbeAddOp2(v, OP_Next, iTab, addr1+1); sqlite3VdbeJumpHere(v, addr1); addr1 = sqlite3VdbeAddOp2(v, OP_Sort, iSorter, 0); sqlite3VdbeAddOp2(v, OP_RowKey, iSorter, regRecord); } if( pIndex->onError!=OE_None ){ const int regRowid = regIdxKey + pIndex->nColumn; const int j2 = sqlite3VdbeCurrentAddr(v) + 2; void * const pRegKey = SQLITE_INT_TO_PTR(regIdxKey); |
︙ | ︙ |
Changes to src/vdbesort.c.
︙ | ︙ | |||
688 689 690 691 692 693 694 | /* Coverage testing note: As things are currently, this call will always ** succeed. This is because the memory cell passed by the VDBE layer ** happens to be the same one as was used to assemble the keys before they ** were passed to the sorter - meaning it is always large enough for the ** largest key. But this could change very easily, so we leave the call ** to sqlite3VdbeMemGrow() in. */ | | | 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | /* Coverage testing note: As things are currently, this call will always ** succeed. This is because the memory cell passed by the VDBE layer ** happens to be the same one as was used to assemble the keys before they ** were passed to the sorter - meaning it is always large enough for the ** largest key. But this could change very easily, so we leave the call ** to sqlite3VdbeMemGrow() in. */ if( NEVER(sqlite3VdbeMemGrow(pOut, pIter->nKey, 0)) ){ return SQLITE_NOMEM; } pOut->n = pIter->nKey; MemSetTypeFlag(pOut, MEM_Blob); memcpy(pOut->z, pIter->aKey, pIter->nKey); return SQLITE_OK; |
︙ | ︙ |
Changes to test/like.test.
︙ | ︙ | |||
304 305 306 307 308 309 310 311 | set sqlite_like_count } 12 # GLOB is optimized regardless of the case_sensitive_like setting. # do_test like-3.19 { set sqlite_like_count 0 queryplan { | > < | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | set sqlite_like_count } 12 # GLOB is optimized regardless of the case_sensitive_like setting. # do_test like-3.19 { set sqlite_like_count 0 db eval {CREATE INDEX i1 ON t1(x);} queryplan { SELECT x FROM t1 WHERE x GLOB 'abc*' ORDER BY 1; } } {abc abcd nosort {} i1} do_test like-3.20 { set sqlite_like_count } 0 do_test like-3.21 { |
︙ | ︙ | |||
518 519 520 521 522 523 524 | } {zz-lower-lower zZ-lower-upper Zz-upper-lower ZZ-upper-upper nosort {} i2} do_test like-5.24 { queryplan { SELECT x FROM t2 WHERE x LIKE 'ZZ%'; } } {zz-lower-lower zZ-lower-upper Zz-upper-lower ZZ-upper-upper nosort {} i2} do_test like-5.25 { | | > > | 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | } {zz-lower-lower zZ-lower-upper Zz-upper-lower ZZ-upper-upper nosort {} i2} do_test like-5.24 { queryplan { SELECT x FROM t2 WHERE x LIKE 'ZZ%'; } } {zz-lower-lower zZ-lower-upper Zz-upper-lower ZZ-upper-upper nosort {} i2} do_test like-5.25 { db eval { PRAGMA case_sensitive_like=on; CREATE TABLE t3(x TEXT); CREATE INDEX i3 ON t3(x); INSERT INTO t3 VALUES('ZZ-upper-upper'); INSERT INTO t3 VALUES('zZ-lower-upper'); INSERT INTO t3 VALUES('Zz-upper-lower'); INSERT INTO t3 VALUES('zz-lower-lower'); } queryplan { SELECT x FROM t3 WHERE x LIKE 'zz%'; } } {zz-lower-lower nosort {} i3} do_test like-5.26 { queryplan { SELECT x FROM t3 WHERE x LIKE 'zZ%'; } |
︙ | ︙ |