/ Check-in [5562cd34]
Login

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

Overview
Comment:Simplifications to the VdbeCursor object.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5562cd343d8f69242e06a51a7f1aef7ee7d78eec
User & Date: drh 2013-11-20 02:53:58
Context
2013-11-21
01:33
Refactor the OP_Column opcode to make it clearer and easier to maintain. Overall, performance tests show about a 1% speed increase with this change. check-in: 972881c6 user: drh tags: trunk
2013-11-20
17:25
Refactoring the OP_Column opcode for improved performance and maintainability. check-in: 7c914e39 user: drh tags: OP_Column-refactor
02:53
Simplifications to the VdbeCursor object. check-in: 5562cd34 user: drh tags: trunk
00:59
Performance improvement for the OP_MustBeInt opcode in the VDBE. check-in: 96a65388 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  1189   1189       return WRC_Abort;
  1190   1190     }
  1191   1191   
  1192   1192     switch( pExpr->op ){
  1193   1193       /* Consider functions to be constant if all their arguments are constant
  1194   1194       ** and pWalker->u.i==2 */
  1195   1195       case TK_FUNCTION:
  1196         -      if( pWalker->u.i==2 ) return 0;
         1196  +      if( pWalker->u.i==2 ) return WRC_Continue;
  1197   1197         /* Fall through */
  1198   1198       case TK_ID:
  1199   1199       case TK_COLUMN:
  1200   1200       case TK_AGG_FUNCTION:
  1201   1201       case TK_AGG_COLUMN:
  1202   1202         testcase( pExpr->op==TK_ID );
  1203   1203         testcase( pExpr->op==TK_COLUMN );

Changes to src/vdbe.c.

  4500   4500     res = 1;
  4501   4501     if( isSorter(pC) ){
  4502   4502       rc = sqlite3VdbeSorterRewind(db, pC, &res);
  4503   4503     }else{
  4504   4504       pCrsr = pC->pCursor;
  4505   4505       assert( pCrsr );
  4506   4506       rc = sqlite3BtreeFirst(pCrsr, &res);
  4507         -    pC->atFirst = res==0 ?1:0;
  4508   4507       pC->deferredMoveto = 0;
  4509   4508       pC->cacheStatus = CACHE_STALE;
  4510   4509       pC->rowidIsValid = 0;
  4511   4510     }
  4512   4511     pC->nullRow = (u8)res;
  4513   4512     assert( pOp->p2>0 && pOp->p2<p->nOp );
  4514   4513     if( res ){

Changes to src/vdbeInt.h.

    57     57   ** Every cursor that the virtual machine has open is represented by an
    58     58   ** instance of the following structure.
    59     59   */
    60     60   struct VdbeCursor {
    61     61     BtCursor *pCursor;    /* The cursor structure of the backend */
    62     62     Btree *pBt;           /* Separate file holding temporary table */
    63     63     KeyInfo *pKeyInfo;    /* Info about index keys needed by index cursors */
    64         -  int iDb;              /* Index of cursor database in db->aDb[] (or -1) */
    65     64     int pseudoTableReg;   /* Register holding pseudotable content. */
    66         -  int nField;           /* Number of fields in the header */
    67         -  Bool zeroed;          /* True if zeroed out and ready for reuse */
           65  +  i16 nField;           /* Number of fields in the header */
           66  +  i8 iDb;               /* Index of cursor database in db->aDb[] (or -1) */
    68     67     Bool rowidIsValid;    /* True if lastRowid is valid */
    69         -  Bool atFirst;         /* True if pointing to first entry */
    70     68     Bool useRandomRowid;  /* Generate new record numbers semi-randomly */
    71     69     Bool nullRow;         /* True if pointing to a row with no data */
    72     70     Bool deferredMoveto;  /* A call to sqlite3BtreeMoveto() is needed */
    73     71     Bool isTable;         /* True if a table requiring integer keys */
    74     72     Bool isIndex;         /* True if an index containing keys only - no data */
    75     73     Bool isOrdered;       /* True if the underlying table is BTREE_UNORDERED */
    76     74     Bool isSorter;        /* True if a new-style sorter */
    77     75     Bool multiPseudo;     /* Multi-register pseudo-cursor */
    78     76     sqlite3_vtab_cursor *pVtabCursor;  /* The cursor for a virtual table */
    79     77     const sqlite3_module *pModule;     /* Module for cursor pVtabCursor */
    80     78     i64 seqCount;         /* Sequence counter */
    81     79     i64 movetoTarget;     /* Argument to the deferred sqlite3BtreeMoveto() */
    82         -  i64 lastRowid;        /* Last rowid from a Next or NextIdx operation */
           80  +  i64 lastRowid;        /* Rowid being deleted by OP_Delete */
    83     81     VdbeSorter *pSorter;  /* Sorter object for OP_SorterOpen cursors */
    84     82   
    85     83     /* Result of last sqlite3BtreeMoveto() done by an OP_NotExists */
    86     84     int seekResult;
    87     85   
    88     86     /* Cached information about the header for the data record that the
    89     87     ** cursor is currently pointing to.  Only valid if cacheStatus matches