SQLite

Check-in [42db7cd2c0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make use of the unpacked key on the OP_IdxInsert on sorters with a LIMIT.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | unpacked-IdxInsert
Files: files | file ages | folders
SHA1: 42db7cd2c0b367f7dfe733bdaf006538937b812a
User & Date: drh 2016-11-09 01:38:56.790
Context
2016-11-09
16:03
Fix a simple comment typo. No changes to code. (check-in: 51d0aed8d6 user: drh tags: unpacked-IdxInsert)
01:38
Make use of the unpacked key on the OP_IdxInsert on sorters with a LIMIT. (check-in: 42db7cd2c0 user: drh tags: unpacked-IdxInsert)
01:19
Fix a typo on the OP_IdxInsert documentation. No code changes. (check-in: e4acd98207 user: drh tags: unpacked-IdxInsert)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/select.c.
583
584
585
586
587
588
589
590

591
592
593
594
595
596
597
    sqlite3VdbeJumpHere(v, addrJmp);
  }
  if( pSort->sortFlags & SORTFLAG_UseSorter ){
    op = OP_SorterInsert;
  }else{
    op = OP_IdxInsert;
  }
  sqlite3VdbeAddOp2(v, op, pSort->iECursor, regRecord);

  if( iLimit ){
    int addr;
    int r1 = 0;
    /* Fill the sorter until it contains LIMIT+OFFSET entries.  (The iLimit
    ** register is initialized with value of LIMIT+OFFSET.)  After the sorter
    ** fills up, delete the least entry in the sorter after each insert.
    ** Thus we never hold more than the LIMIT+OFFSET rows in memory at once */







|
>







583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
    sqlite3VdbeJumpHere(v, addrJmp);
  }
  if( pSort->sortFlags & SORTFLAG_UseSorter ){
    op = OP_SorterInsert;
  }else{
    op = OP_IdxInsert;
  }
  sqlite3VdbeAddOp4Int(v, op, pSort->iECursor, regRecord,
                       regBase+nOBSat, nBase-nOBSat);
  if( iLimit ){
    int addr;
    int r1 = 0;
    /* Fill the sorter until it contains LIMIT+OFFSET entries.  (The iLimit
    ** register is initialized with value of LIMIT+OFFSET.)  After the sorter
    ** fills up, delete the least entry in the sorter after each insert.
    ** Thus we never hold more than the LIMIT+OFFSET rows in memory at once */