SQLite

Check-in [7a959f6d1e]
Login

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

Overview
Comment:Add two NEVER() operators in the sqlite3BtreeRowCountEst() routine.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | auto-analyze
Files: files | file ages | folders
SHA1: 7a959f6d1ea038988cdb4c02d6f37abaec2580a0
User & Date: drh 2017-02-23 02:15:33.201
Context
2017-03-02
13:22
Merge recent trunk enhancements. (check-in: c60cdb4761 user: drh tags: auto-analyze)
2017-02-23
02:15
Add two NEVER() operators in the sqlite3BtreeRowCountEst() routine. (check-in: 7a959f6d1e user: drh tags: auto-analyze)
00:58
Do a single OP_Expire at the very end of "PRAGMA optimize", and omit the OP_Expire on ANALYZE commands invoked by the pragma. (check-in: 188300a337 user: drh tags: auto-analyze)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/btree.c.
5326
5327
5328
5329
5330
5331
5332




5333
5334

5335
5336
5337
5338
5339
5340
5341
*/
i64 sqlite3BtreeRowCountEst(BtCursor *pCur){
  i64 n;
  u8 i;

  assert( cursorOwnsBtShared(pCur) );
  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );




  if( pCur->eState!=CURSOR_VALID ) return -1;
  if( pCur->apPage[pCur->iPage]->leaf==0 ) return -1;

  for(n=1, i=0; i<=pCur->iPage; i++){
    n *= pCur->apPage[i]->nCell;
  }
  return n;
}

/*







>
>
>
>
|
|
>







5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
*/
i64 sqlite3BtreeRowCountEst(BtCursor *pCur){
  i64 n;
  u8 i;

  assert( cursorOwnsBtShared(pCur) );
  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );

  /* Currently this interface is only called by the OP_IfSmaller
  ** opcode, and it that case the cursor will always be valid and
  ** will always point to a leaf node. */
  if( NEVER(pCur->eState!=CURSOR_VALID) ) return -1;
  if( NEVER(pCur->apPage[pCur->iPage]->leaf==0) ) return -1;

  for(n=1, i=0; i<=pCur->iPage; i++){
    n *= pCur->apPage[i]->nCell;
  }
  return n;
}

/*