【TiDBer 唠嗑茶话会 48】非正式 TiDB相关 SQL 脚本征集大赛!

贡献摘录


如果不涉及分区表用下面的方式查看表的使用情况:

select TABLE_SCHEMA,TABLE_NAME,TABLE_ROWS,
(DATA_LENGTH+INDEX_LENGTH)/1024/1024/1024 as table_size from tables order by table_size 
desc limit 20;

另外partition表提供了分区表和非分区表的资源使用情况(我们使用分区表较多):

select TABLE_SCHEMA,TABLE_NAME,PARTITION_NAME,TABLE_ROWS,
(DATA_LENGTH+INDEX_LENGTH)/1024/1024/1024 as table_size from 
information_schema.PARTITIONS order by table_size desc limit 20;