Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 各位大佬发个sql 把所有表按照容量排序
【TiDB Usage Environment】Production Environment / Testing / PoC
【TiDB Version】5.4.0
【Reproduction Path】Operations performed that led to the issue
【Encountered Issue: Issue Phenomenon and Impact】
【Resource Configuration】
【Attachments: Screenshots / Logs / Monitoring】
SELECT a.`TABLE_SCHEMA`, a.`TABLE_NAME`, ROUND(a.`DATA_LENGTH`/1024/1024/1024, 2) gb
FROM information_schema.tables a
ORDER BY 3 DESC;
SELECT
t.TABLE_NAME,
t.TABLE_ROWS,
t.TABLE_TYPE,
ROUND(t.DATA_LENGTH/1024/1024/1024,2) data_GB,
ROUND(t.INDEX_LENGTH/1024/1024/1024,2) index_GB,
t.CREATE_OPTIONS,
t.TABLE_COMMENT
FROM
INFORMATION_SCHEMA.`TABLES` t
WHERE
table_schema = 'XX'
AND t.table_type='BASE TABLE'
ORDER BY t.DATA_LENGTH DESC;
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.