1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Simplify the routine that attempts to estimate the size of an rtree index

by looking at the sqlite_stat1 entry for the %_rowid table.

FossilOrigin-Name: 06c329c17c2c2de8bc1ca7f3b0b929055675761a8be7a7e8b4a9fc5cca0d1679
This commit is contained in:
drh
2021-09-16 07:32:24 +00:00
parent 36784e0fb1
commit 162f153579
3 changed files with 9 additions and 20 deletions

View File

@ -3410,7 +3410,7 @@ static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){
char *zSql;
sqlite3_stmt *p;
int rc;
i64 nRow = 0;
i64 nRow = RTREE_MIN_ROWEST;
rc = sqlite3_table_column_metadata(
db, pRtree->zDb, "sqlite_stat1",0,0,0,0,0,0
@ -3427,20 +3427,10 @@ static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){
if( rc==SQLITE_OK ){
if( sqlite3_step(p)==SQLITE_ROW ) nRow = sqlite3_column_int64(p, 0);
rc = sqlite3_finalize(p);
}else if( rc!=SQLITE_NOMEM ){
rc = SQLITE_OK;
}
if( rc==SQLITE_OK ){
if( nRow==0 ){
pRtree->nRowEst = RTREE_DEFAULT_ROWEST;
}else{
pRtree->nRowEst = MAX(nRow, RTREE_MIN_ROWEST);
}
}
sqlite3_free(zSql);
}
pRtree->nRowEst = MAX(nRow, RTREE_MIN_ROWEST);
return rc;
}