导出的mysql不一样大_导出/导入后数据库大小不同

  • Post author:
  • Post category:mysql


bd96500e110b49cbb3cd949968f18be7.png

I had to export mysql database using mysqldump for backup reasons.

To compare the size given by phpmyadmin, I downloaded the dump on my local machine then import the dump using SQLYog into a local database.

Now, when I compare the size given by phpmyadmin on my machine and the remote machine, I end up with the imported database on my local machine to be smaller than the one on the remote machine :

remote machine database size : 112,3 Mib

local machine database size : 95,7 Mib

I would like to know what could be the reasons for such a difference ?

Cheers

解决方案

112,3 Mio what? Rows? b?

If it’s storage size, there’s not much to worry about, it’s about how disk space usage is optimized (vacuum/optimize table).

http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html

On the other hand if it’S rows, you’ll have to track down the tables that differ and figure out why.

use(replace schema name)

SELECT TABLE_NAME, table_rows, data_length, index_length,

round(((data_length + index_length) / 1024 / 1024),2) “Size in MB”

FROM information_schema.TABLES WHERE table_schema = “test”

union all

SELECT ‘total’, sum(table_rows), sum(data_length), sum(index_length),

sum(round(((data_length + index_length) / 1024 / 1024),2)) “Size in MB”

FROM information_schema.TABLES WHERE table_schema = “test” group by 1



版权声明:本文为weixin_31809171原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。