1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

The analyze_as_needed pragma now responds to table size growth and will

automatically rerun the analysis after each 10x size increase.

FossilOrigin-Name: bfbdd07409688fac4ccddbab3639745f6152e23d
This commit is contained in:
drh
2017-02-17 19:24:06 +00:00
parent 72052a73a3
commit 5e98e838da
8 changed files with 104 additions and 34 deletions

View File

@@ -5319,6 +5319,25 @@ int sqlite3BtreeEof(BtCursor *pCur){
return (CURSOR_VALID!=pCur->eState);
}
/*
** Return an estimate for the number of rows in the table that pCur is
** pointing to. Return a negative number if no estimate is currently
** available.
*/
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-1]->leaf==0 ) return -1;
for(n=1, i=0; i<pCur->iPage; i++){
n *= pCur->apPage[i]->nCell;
}
return n;
}
/*
** Advance the cursor to the next entry in the database. If
** successful then set *pRes=0. If the cursor