1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Add the estimated number of output rows to the EXPLAIN QUERY PLAN output

if compiled with SQLITE_EXPLAIN_ESTIMATED_ROWS.  This feature is off by
default for the time being.

FossilOrigin-Name: daa8314fba9dc3c4f5e7fbda42c97604fbfc4392
This commit is contained in:
drh
2014-10-10 17:20:39 +00:00
parent 6c97789d2e
commit 98545bb2ed
3 changed files with 14 additions and 7 deletions

View File

@@ -2875,6 +2875,13 @@ static void explainOneScan(
sqlite3XPrintf(&str, 0, " VIRTUAL TABLE INDEX %d:%s",
pLoop->u.vtab.idxNum, pLoop->u.vtab.idxStr);
}
#endif
#ifdef SQLITE_EXPLAIN_ESTIMATED_ROWS
if( pLoop->nOut>=10 ){
sqlite3XPrintf(&str, 0, " (~%llu rows)", sqlite3LogEstToInt(pLoop->nOut));
}else{
sqlite3StrAccumAppend(&str, " (~1 row)", 9);
}
#endif
zMsg = sqlite3StrAccumFinish(&str);
sqlite3VdbeAddOp4(v, OP_Explain, iId, iLevel, iFrom, zMsg, P4_DYNAMIC);