mirror of
https://github.com/MLBZ521/MacAdmin.git
synced 2026-02-03 05:53:26 +00:00
Add Database and Table Size Queries
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user