diff --git a/plugins/Stats/StatsPlugin.py b/plugins/Stats/StatsPlugin.py
index dfa6a7d7..793bf15b 100644
--- a/plugins/Stats/StatsPlugin.py
+++ b/plugins/Stats/StatsPlugin.py
@@ -1,6 +1,7 @@
import time
import cgi
import os
+import json
from Plugin import PluginManager
from Config import config
@@ -169,7 +170,15 @@ class UiRequestPlugin(object):
# Db
yield "
Db:
"
for db in sys.modules["Db.Db"].opened_dbs:
- yield "- %.3fs: %s
" % (time.time() - db.last_query_time, db.db_path.encode("utf8"))
+ tables = [row["name"] for row in db.execute("SELECT name FROM sqlite_master WHERE type = 'table'").fetchall()]
+ table_rows = {}
+ for table in tables:
+ table_rows[table] = db.execute("SELECT COUNT(*) AS c FROM %s" % table).fetchone()["c"]
+ db_size = os.path.getsize(db.db_path) / 1024.0 / 1024.0
+ yield "- %.3fs: %s %.3fMB, table rows: %s
" % (
+ time.time() - db.last_query_time, db.db_path.encode("utf8"), db_size, json.dumps(table_rows, sort_keys=True)
+ )
+
# Sites
yield "
Sites:"