共计 1050 个字符,预计需要花费 3 分钟才能阅读完成。
SELECT temp.`Table Name` AS tableName,
CONCAT(temp.`Number of Rows`, 'M') AS NumberofRows,
CONCAT(temp.`Data Size`, 'G') AS DataSize,
CONCAT(temp.`Index Size`, 'G') AS IndexSize,
CONCAT(temp.Total, 'G') AS Total
FROM (SELECT CONCAT(table_schema, '.', table_name) AS 'Table Name',
ROUND(table_rows / 1000000, 4) AS 'Number of Rows',
ROUND(data_length / (1024 * 1024 * 1024), 4) AS 'Data Size',
ROUND(index_length / (1024 * 1024 * 1024), 4) AS 'Index Size',
ROUND((data_length + index_length) / (1024 * 1024 * 1024), 4) AS 'Total'
FROM information_schema.TABLES
WHERE table_schema LIKE 'YOUR_DATABASE_NAME') temp
ORDER BY temp.Total DESC
查询结果如下:
tableName | NumberofRows | DataSize | IndexSize | Total |
---|---|---|---|---|
umami_2.website_event | 0.0406M | 0.0142G | 0.0662G | 0.0805G |
umami_2.session | 0.0185M | 0.0034G | 0.0368G | 0.0403G |
umami_2.team_user | 0.0000M | 0.0000G | 0.0000G | 0.0001G |
umami_2.team | 0.0000M | 0.0000G | 0.0000G | 0.0001G |
umami_2.session_data | 0.0000M | 0.0000G | 0.0000G | 0.0001G |
umami_2.report | 0.0000M | 0.0000G | 0.0001G | 0.0001G |
umami_2.event_data | 0.0000M | 0.0000G | 0.0001G | 0.0001G |
umami_2.website | 0.0000M | 0.0000G | 0.0001G | 0.0001G |
umami_2._prisma_migrations | 0.0000M | 0.0000G | 0.0000G | 0.0000G |
umami_2.user | 0.0000M | 0.0000G | 0.0000G | 0.0000G |
正文完