大家好,有人知道如何估计一个 mysql 表的大小吗?我的意思是我打算备份所有服务器上的所有 mysql 表,但我想知道每个转储表应该有多大而不进行物理转储。有一些命令允许执行此操作吗?我在 debian 6 Cheers 上使用 mysql 5.1
小智 5
正如所看到的在这里,你可以在你的数据库上运行这些查询(从页面上的评论偷了,然后改动)。
SELECT table_schema 'database',
concat( round( sum( data_length + index_length ) / ( 1024 *1024 ) , 2 ) , 'M' ) size
FROM information_schema.TABLES
WHERE ENGINE=('MyISAM' || 'InnoDB' )
GROUP BY table_schema;
SELECT concat( table_schema, '.', table_name ) table_name,
concat( round( data_length / ( 1024 *1024 ) , 2 ) , 'M' ) data_length,
concat( round( index_length / ( 1024 *1024 ) , 2 ) , 'M' ) index_length,
concat( round( round( data_length + index_length ) / ( 1024 *1024 ) , 2 ) , 'M' ) total_size
FROM information_schema.TABLES
ORDER BY ( data_length + index_length ) DESC;
归档时间: |
|
查看次数: |
4295 次 |
最近记录: |