SQLite

Check-in [eac0e827a6]
Login

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

Overview
Comment:Avoid a few unnecessary calls to sqlite3BtreeMovetoUnpacked().
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | unpacked-IdxInsert
Files: files | file ages | folders
SHA1: eac0e827a61cfec4dd9b6d407ff398e9fda3510b
User & Date: drh 2016-11-10 20:42:08.396
Context
2016-11-11
17:52
Merge enhancements and bug-fixes from trunk. (check-in: 5515b827dc user: drh tags: unpacked-IdxInsert)
2016-11-10
21:19
Break up the sqlite3BtreeMovetoUnpacked() routine into an eponymous routine and sqlite3BtreeMovetoIntkey(). Each routine specializes in a single kind of btree. (Leaf check-in: 9a64a4f235 user: drh tags: split-moveto)
20:42
Avoid a few unnecessary calls to sqlite3BtreeMovetoUnpacked(). (check-in: eac0e827a6 user: drh tags: unpacked-IdxInsert)
17:01
When doing a REPLACE on a WITHOUT ROWID table with no secondary indexes, bypass the OP_NoConflict/OP_Delete sequence and directly overwrite any preexisting row, for a performance increase. (check-in: f7041cbb63 user: drh tags: unpacked-IdxInsert)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/btree.c.
8009
8010
8011
8012
8013
8014
8015
8016


8017
8018
8019
8020
8021
8022
8023
8024
8025
    /* If this is an insert into a table b-tree, invalidate any incrblob 
    ** cursors open on the row being replaced */
    invalidateIncrblobCursors(p, pX->nKey, 0);

    /* If the cursor is currently on the last row and we are appending a
    ** new row onto the end, set the "loc" to avoid an unnecessary
    ** btreeMoveto() call */
    if( (pCur->curFlags&BTCF_ValidNKey)!=0 && pX->nKey>0


      && pCur->info.nKey==pX->nKey-1 ){
       loc = -1;
    }else if( loc==0 ){
      rc = sqlite3BtreeMovetoUnpacked(pCur, 0, pX->nKey, appendBias, &loc);
      if( rc ) return rc;
    }
  }else if( loc==0 ){
    if( pX->nMem ){
      UnpackedRecord r;







|
>
>
|
|







8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
    /* If this is an insert into a table b-tree, invalidate any incrblob 
    ** cursors open on the row being replaced */
    invalidateIncrblobCursors(p, pX->nKey, 0);

    /* If the cursor is currently on the last row and we are appending a
    ** new row onto the end, set the "loc" to avoid an unnecessary
    ** btreeMoveto() call */
    if( (pCur->curFlags&BTCF_ValidNKey)!=0 && pX->nKey==pCur->info.nKey ){
      loc = 0;
    }else if( (pCur->curFlags&BTCF_ValidNKey)!=0 && pX->nKey>0
               && pCur->info.nKey==pX->nKey-1 ){
      loc = -1;
    }else if( loc==0 ){
      rc = sqlite3BtreeMovetoUnpacked(pCur, 0, pX->nKey, appendBias, &loc);
      if( rc ) return rc;
    }
  }else if( loc==0 ){
    if( pX->nMem ){
      UnpackedRecord r;