1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +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;
}

View File

@ -1,5 +1,5 @@
C Mark\svarious\sunreachable\sbranches\sin\srtree.c\swith\sALWAYS()\sor\sNEVER().
D 2021-09-16T05:39:07.773
C Simplify\sthe\sroutine\sthat\sattempts\sto\sestimate\sthe\ssize\sof\san\srtree\sindex\nby\slooking\sat\sthe\ssqlite_stat1\sentry\sfor\sthe\s%_rowid\stable.
D 2021-09-16T07:32:24.179
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -393,7 +393,7 @@ F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c3350
F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/geopoly.c 98d45533989e908bf65b43f36ff6eaad95a9ffe6f3b6b8658fbd47d45c58b10b
F ext/rtree/rtree.c 7898027fcf24e9648755c84aee477a5cf36e56f783f55d02d053c0409d57b30a
F ext/rtree/rtree.c 2b1b062db00ffe1c23b02a41bd87a41e7fa48045b117d1a018086bdff4307012
F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412
F ext/rtree/rtree1.test 00792b030a4e188ff1b22e8530e8aa0452bb5dd81c2b18cb004afc7dc63e040e
F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d
@ -1923,8 +1923,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P c74c07cc86443057d34284ae31eb68470741592b0e61072fd5e120e82919169b f7ad73c49507c9436adc7fe1b865f801eefcc7ea6b3ba35e83e63029beb03016
R 37a433ae96b1c5a938d63509ab7d490e
T +closed f7ad73c49507c9436adc7fe1b865f801eefcc7ea6b3ba35e83e63029beb03016
P 4fab9089868bbb05a192da09bc201f0a84c5b9bef39dcb063afc1d7658299fdd
R 928648a0ed48b62d45ae4ba163d95e7e
U drh
Z 72919531593fe5f120dc25a5a4b2d7d0
Z a20a445e37b9e3e0394873e1f6259d3c

View File

@ -1 +1 @@
4fab9089868bbb05a192da09bc201f0a84c5b9bef39dcb063afc1d7658299fdd
06c329c17c2c2de8bc1ca7f3b0b929055675761a8be7a7e8b4a9fc5cca0d1679