抛砖引入,分享一段查看库表容量的SQL,看看大家有没有更好的(普通用户即可使用)

-- 查看记录数(普通用户)
select
    table_name,
    table_rows,
    avg_row_length,
    round(data_length/1024/1024,2) data_size_M,
    round(index_length/1024/1024,2) index_size_M
from 
    information_schema.tables
where 
    table_schema = 'test'
    -- and table_name = 't1'
;

非常nice

2 个赞

非常nice

1 个赞