Change the "PRAGMA stats" command to report size values in LogEst units.

The eliminates the need for sqlite3LogEstToInt() unless non-standard
compile-time options are used, so leave it out except in those cases.

FossilOrigin-Name: 832c237fcbe83dd4f5a18a06acb0aeb7e2b9e712
This commit is contained in:
drh 2016-02-25 21:19:03 +00:00
parent aa9ffaba4a
commit d566c95179
5 changed files with 25 additions and 15 deletions

View File

@ -1,5 +1,5 @@
C Disable\sthe\sRESTRICT\sforeign\skey\saction\sif\s"PRAGMA\sdefer_foreign_keys"\sis\sset.
D 2016-02-25T20:17:55.205
C Change\sthe\s"PRAGMA\sstats"\scommand\sto\sreport\ssize\svalues\sin\sLogEst\sunits.\nThe\seliminates\sthe\sneed\sfor\ssqlite3LogEstToInt()\sunless\snon-standard\ncompile-time\soptions\sare\sused,\sso\sleave\sit\sout\sexcept\sin\sthose\scases.
D 2016-02-25T21:19:03.487
F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4
@ -342,7 +342,7 @@ F src/parse.y c3ce2c4a7cbf0b699239be6b2a945c5cb51875e2
F src/pcache.c 647bb53a86b7bbcf55ad88089b3ea5a9170b90df
F src/pcache.h 4d0ccaad264d360981ec5e6a2b596d6e85242545
F src/pcache1.c 72f644dc9e1468c72922eff5904048427b817051
F src/pragma.c 80ee77226d0008d9188356a6cbbe6010866e1bee
F src/pragma.c d6028d23a9495a8b55f2075e3244ec9a0485e03e
F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c
F src/prepare.c 22df6171aec1d86904ed2ad30c2348a5748aa04e
F src/printf.c 63e6fb12bbe702dd664dc3703776c090383a5a26
@ -354,7 +354,7 @@ F src/shell.c 89b73e894e737cc2f21e4bce0feb3ea21cc61124
F src/sqlite.h.in a7caa805a345d6a14136c11ccfa6f4c1a6ef6e7b
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d
F src/sqliteInt.h 5a87bccd05996f4c3facd8f831cf92a05b818b6f
F src/sqliteInt.h b9ac8b9c9798f57d80a9756f86abf1dbd9424ec9
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba
F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
@ -412,7 +412,7 @@ F src/treeview.c c525282442111b3f61eb176784567cd6654db5dc
F src/trigger.c e14840ee0c3e549e758ec9bf3e4146e166002280
F src/update.c a7eeeaffad59c6506f01303a071dac11de8269ca
F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c
F src/util.c 38c06684c922694809ccb988a13562c16890a3d5
F src/util.c 6ed9d7bdd3b0a30742027b6d8e8e1a9e2b14f373
F src/vacuum.c feb1eabb20987983d9350cad98299b21fa811f52
F src/vdbe.c 87ae3a5657fefed7875f3eb30e7ababd48013d71
F src/vdbe.h c743791f723049db94f009e3e30958952bc2d512
@ -1429,8 +1429,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P bf46179d4484376909dce40ffcc06fecb19b3544
Q +8fea1166016c659ece83e0045bc348f478a9ba6a
R c44565069d5be6a8f7796f6b44b6c97f
U dan
Z 38dd13c1fd26f5b1e4d5f260c4aeb7b1
P 9ffff484bb4b67c29dda6180d7d766ad13988fe1
R 23bd8dd7478d22b4cba45c8ed3333a25
U drh
Z bce9cf80c6d6995d2550774b29ef2e7b

View File

@ -1 +1 @@
9ffff484bb4b67c29dda6180d7d766ad13988fe1
832c237fcbe83dd4f5a18a06acb0aeb7e2b9e712

View File

@ -1102,14 +1102,14 @@ void sqlite3Pragma(
sqlite3VdbeMultiLoad(v, 1, "ssii",
pTab->zName,
0,
(int)sqlite3LogEstToInt(pTab->szTabRow),
(int)sqlite3LogEstToInt(pTab->nRowLogEst));
pTab->szTabRow,
pTab->nRowLogEst);
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
sqlite3VdbeMultiLoad(v, 2, "sii",
pIdx->zName,
(int)sqlite3LogEstToInt(pIdx->szIdxRow),
(int)sqlite3LogEstToInt(pIdx->aiRowLogEst[0]));
pIdx->szIdxRow,
pIdx->aiRowLogEst[0]);
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);
}
}

View File

@ -3686,7 +3686,11 @@ LogEst sqlite3LogEstAdd(LogEst,LogEst);
#ifndef SQLITE_OMIT_VIRTUALTABLE
LogEst sqlite3LogEstFromDouble(double);
#endif
#if defined(SQLITE_ENABLE_STMT_SCANSTAT) || \
defined(SQLITE_ENABLE_STAT3_OR_STAT4) || \
defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)
u64 sqlite3LogEstToInt(LogEst);
#endif
/*
** Routines to read and write variable-length integers. These used to

View File

@ -1400,8 +1400,14 @@ LogEst sqlite3LogEstFromDouble(double x){
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */
#if defined(SQLITE_ENABLE_STMT_SCANSTAT) || \
defined(SQLITE_ENABLE_STAT3_OR_STAT4) || \
defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)
/*
** Convert a LogEst into an integer.
**
** Note that this routine is only used when one or more of various
** non-standard compile-time options is enabled.
*/
u64 sqlite3LogEstToInt(LogEst x){
u64 n;
@ -1415,3 +1421,4 @@ u64 sqlite3LogEstToInt(LogEst x){
}
return (n+8)>>(3-x);
}
#endif /* defined SCANSTAT or STAT4 or ESTIMATED_ROWS */