mysql查询某张表数据量

SELECT
table_schema,
table_name AS 'name',
table_rows AS 'rows',
concat( round( DATA_LENGTH / 1024 / 1024, 2 ), 'MB' ) AS ALL_DATA,
concat( round( INDEX_LENGTH / 1024 / 1024, 2 ), 'MB' ) AS ALL_INDEX,
concat( round( ( DATA_LENGTH + INDEX_LENGTH )/ 1024 / 1024, 2 ), 'MB' ) AS TOTAL
FROM
information_schema.TABLES
WHERE
table_schema = '当前schema名称'
and TABLE_NAME = '表名';

posted on 2023-05-15 09:51  今宵别梦涵  阅读(23)  评论(0编辑  收藏  举报

导航