2

I have dumped a database using phpmyadmin and had 390MB and then imported it using command line into new database, then it showed the size 360.

Why this imported database is smaller? Thanks.

Droid-Bird
  • 1,417
  • 5
  • 19
  • 43

1 Answers1

2

When you delete data from a database, the records usually aren't actually deleted from the database files, just marked as deleted – the space can be reused for new records later. When you export a database, these deleted records naturally aren't exported, or recreated when you import the database.

This reuse saves a little time when records are added, because you don't always have to make the file larger. And it saves a lot of time when deleting records – deleting something from the middle of a file involves shifting all the data that comes after it.

millimoose
  • 39,073
  • 9
  • 82
  • 134
  • thank you very much for explaining me so nicely. I have an additional question, if I may ask now, Is there any way to check these to database (on a same server) and verify whether they really have same (not deleted, working) entries, so that I can be assured that the import has been completed successfully? * I am using Linux, MySQL, phpmyadmin, webmin etc. – Droid-Bird Dec 07 '11 at 10:23
  • @Droid-Bird I don't know, and even if I did this is something you should ask as a new question. – millimoose Dec 07 '11 at 11:39
  • you should perform a MD5 check between two files. – Rene Oct 31 '14 at 10:58
  • @ReneBrakus The OP has already established that after reimporting the data, the resulting data files are significantly smaller. How do you imagine them having the same MD5 hash? (A vanishingly unlikely collision notwithstanding.) – millimoose Nov 22 '14 at 22:28