We found 3 different size of a MySQL Database Instance as follows:
- Mysqldump output
- Data directory size (even if we exclude size of bin-logs,error-logs)
- SUM (data_length + index_length ) calculated from information_schema.tables
Why we faced these differences and what could be used as my Instance size?
Please help.
Best Answer
1
is probably 1 byte and maximal int value (signed) =2147483647
is 10 bytes and minimal int value =-2147483648
is 11 bytes).*.ibd
,*.myi
,*.myd
,*.frm
. Both MyISAM and InnoDB tables may contain some empty space (for example after deleting some rows) which will not be automatically reclaimed by the filesystem, InnoDB files contain not only actual row data but old versions of records, redo logs and other information needed for transactions.In the end it depends on your needs for the size - do you need to know how much space to allocate for backups? #1 or #2 may be what you need, depending on your backup strategy and after accounting for compression. Do you need to know how big disks/cloud storage to pay for - #2 is probably the best bet.
I personally do not see much use for #3 in general, but you can use it to get some average storage needed for a record so you can project future grow of specific tables.
I am sure I missed some differences but hopefully nothing big.