mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-16 16:55:27 +00:00
feat(db): measure the database's size per table and keep the samples
IDatabaseUsage: MySQL/MariaDB from information_schema.TABLES (fresh statistics on MySQL 8), SQLite from its page counts and the dbstat table (now compiled in) with counted rows. Samples go to database_usage and database_usage_tables (migrations 105 / 88). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
19
migrations/dlu/sqlite/88_database_usage.sql
Normal file
19
migrations/dlu/sqlite/88_database_usage.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
/* How much room the game database takes, per sample and per table. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS database_usage (
|
||||
time BIGINT NOT NULL PRIMARY KEY,
|
||||
total_bytes BIGINT NOT NULL DEFAULT 0,
|
||||
free_bytes BIGINT NOT NULL DEFAULT 0,
|
||||
data_bytes BIGINT NOT NULL DEFAULT 0,
|
||||
index_bytes BIGINT NOT NULL DEFAULT 0,
|
||||
row_count BIGINT NOT NULL DEFAULT 0,
|
||||
disk_free BIGINT NOT NULL DEFAULT 0,
|
||||
disk_total BIGINT NOT NULL DEFAULT 0
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS database_usage_tables (
|
||||
time BIGINT NOT NULL,
|
||||
table_name TEXT NOT NULL,
|
||||
data_bytes BIGINT NOT NULL DEFAULT 0,
|
||||
index_bytes BIGINT NOT NULL DEFAULT 0,
|
||||
row_count BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (time, table_name)
|
||||
);
|
||||
Reference in New Issue
Block a user