导出/导入后数据库大小不同 [英] Database size different after export/import
问题描述
出于备份原因,我不得不使用mysqldump导出mysql数据库.
I had to export mysql database using mysqldump for backup reasons.
要比较phpmyadmin给出的大小,我将转储下载到本地计算机上,然后使用SQLYog将转储导入本地数据库.
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.
现在,当我比较本机和远程计算机上phpmyadmin给出的大小时,最终我的本地计算机上的导入数据库小于远程计算机上的数据库:
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 :
- 远程计算机数据库大小:112,3 Mib
- 本地计算机数据库大小:95.7 Mib
我想知道造成这种差异的原因是什么?
I would like to know what could be the reasons for such a difference ?
欢呼
推荐答案
112,3 Mio是什么?排? b?
112,3 Mio what? Rows? b?
如果是存储大小,则无需担心,这与如何优化磁盘空间使用情况(真空/优化表)有关. http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html
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.
使用(替换架构名称)
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
这篇关于导出/导入后数据库大小不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!