Score:1

Mysqldump generated file that is smaller size then database

cn flag

My database is 250 MB and dump size is 82 MB. I am using latest MariaDB. running this command:

mysqldump -u user -p database > t.sql
in flag
Well, that's not uncommon. And your question is what exactly?
in flag
This seems relevant: https://dba.stackexchange.com/questions/189229/large-discrepancy-between-information-schema-database-size-vs-mysqldump-database
Mr. Kovalski avatar
cn flag
I wanted to make a backup. This is how I usually do it. But the difference in size is making me concerned. Shouldn't the dump file be larger because of the extra characters in it.
in flag
That depends on a lot of factors. The answer in the linked question on [dba.se] explains this pretty well.
Mr. Kovalski avatar
cn flag
Thanks @GeraldSchneider that makes sense, as we have just fresh installed new system and lot of tables are empty. Will test to make sure.
Paul avatar
cn flag
Sounds like a perfectly good excuse to restore from bare metal to confirm your backups perform as expected.
Score:2
ua flag
  • The dump does not include the INDEXes other than the PRIMARY KEY.
  • The dump does not include "free space" in the disk files.
  • The dump is text, not binary. For example a BIGINT takes 8 bytes in the file, but if, say, the value is "1" it takes 2 bytes in the dump: "...,1,..." (the number plus one of the commas).
  • On the other hand, some numbers, strings, dates, etc, will take more space in the dump.
  • An empty table takes a minimum of something like 24KB on disk, but only a few hundred bytes (mostly for the CREATE TABLE) in the dump.
  • The dump is a text file; look at some of it (via more or less or something like that).

So, your 3:1 shrinkage is quite feasible. And a 2:1 expansion is possible.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.