feat: add syncthing debug database-statistics command (#10117)
This adds a command that shows database statistics. Currently it requires a fork of the sqlite package to add the dbstats virtual table; the modernc variant already has it. This also provides the canonical mapping between folder ID and database file, for tinkerers... ``` % ./bin/syncthing debug database-statistics DATABASE FOLDER ID TABLE SIZE FILL ======== ====== == ===== ==== ==== main.db - folders 4 KiB 8.4 % main.db - folders_database_name 4 KiB 6.0 % main.db - kv 4 KiB 41.1 % main.db - schemamigrations 4 KiB 3.9 % main.db - sqlite_autoindex_folders_1 4 KiB 3.7 % ... folder.0007-txpxsvyd.db w3ejt-fn4dm indexids 4 KiB 1.5 % folder.0007-txpxsvyd.db w3ejt-fn4dm kv 4 KiB 0.8 % folder.0007-txpxsvyd.db w3ejt-fn4dm mtimes 608 KiB 81.5 % folder.0007-txpxsvyd.db w3ejt-fn4dm schemamigrations 4 KiB 3.9 % folder.0007-txpxsvyd.db w3ejt-fn4dm sqlite_autoindex_blocklists_1 4108 KiB 89.5 % folder.0007-txpxsvyd.db w3ejt-fn4dm sqlite_autoindex_blocks_1 700020 KiB 88.1 % folder.0007-txpxsvyd.db w3ejt-fn4dm sqlite_autoindex_devices_1 4 KiB 3.6 % folder.0007-txpxsvyd.db w3ejt-fn4dm sqlite_autoindex_kv_1 4 KiB 0.6 % folder.0007-txpxsvyd.db w3ejt-fn4dm sqlite_schema 12 KiB 45.9 % folder.0007-txpxsvyd.db w3ejt-fn4dm sqlite_sequence 4 KiB 1.0 % folder.0007-txpxsvyd.db w3ejt-fn4dm sqlite_stat1 4 KiB 12.2 % folder.0007-txpxsvyd.db w3ejt-fn4dm sqlite_stat4 4 KiB 0.2 % folder.0007-txpxsvyd.db w3ejt-fn4dm (total) 1906020 KiB 92.8 % main.db + children - (total) 2205888 KiB 92.0 % ```
This commit is contained in:
@@ -22,7 +22,7 @@ require (
|
||||
github.com/julienschmidt/httprouter v1.3.0
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||
github.com/maruel/panicparse/v2 v2.5.0
|
||||
github.com/mattn/go-sqlite3 v1.14.27
|
||||
github.com/mattn/go-sqlite3 v1.14.28
|
||||
github.com/maxbrunsfeld/counterfeiter/v6 v6.11.2
|
||||
github.com/maxmind/geoipupdate/v6 v6.1.0
|
||||
github.com/miscreant/miscreant.go v0.0.0-20200214223636-26d376326b75
|
||||
@@ -108,3 +108,6 @@ require (
|
||||
|
||||
// https://github.com/gobwas/glob/pull/55
|
||||
replace github.com/gobwas/glob v0.2.3 => github.com/calmh/glob v0.0.0-20220615080505-1d823af5017b
|
||||
|
||||
// https://github.com/mattn/go-sqlite3/pull/1338
|
||||
replace github.com/mattn/go-sqlite3 v1.14.28 => github.com/calmh/go-sqlite3 v1.14.29-0.20250520105817-2e94cda3f7f8
|
||||
|
||||
Reference in New Issue
Block a user