Add Database and Table Size Queries

This commit is contained in:
Zack T
2024-06-18 12:41:02 -07:00
parent 74e8156ee8
commit 9ffbd7dc4a

View File

@@ -1,5 +1,29 @@
-- Queries on Miscellaneous Configurations
-- ##################################################
-- Size of the jamfsoftware database
SELECT
table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024 / 1024, 2) AS "Size in GB"
FROM information_schema.TABLES
WHERE table_schema = "jamfsoftware";
-- Get all tables larger than <500MB> in the jamfsoftware database
SELECT
table_name,
Round(( ( index_length ) / 1024 / 1024 ), 2) AS "Index Size (MB)",
Round(( ( data_length + index_length ) / 1024 / 1024 ), 2) AS "Table Size (MB)",
Round(( data_free / 1024 / 1024 ), 2) AS "Data Free (MB)",
table_rows
FROM information_schema.tables
WHERE
table_schema = "jamfsoftware"
and Round(( ( data_length + index_length ) / 1024 / 1024 ), 2) > 500
ORDER BY 3
DESC;
-- ##################################################
-- Computer Inventory Submissions