I use MariaDB 10.1.16
I do very simple job this time.
Select data from oracle and Make csv file Load that in MariaDB using load infile data command. DB Engine is InnoDB.
Data row count is 6497641. Both table is created same query. PK is auto_increment and int type;
Row created by...
size of tables is below.
Contents in mysql.innodb_table_stats is below.
I wanna know why the size of files is different.
thank you.
The order of the rows can make a big difference. If the data is sorted by the PRIMARY KEY
as it is inserted, the blocks will be packed nearly full. If the rows are randomly sorted, the end result will be blocks that are about 69% full. This is the nature of inserting into a BTree.
n_rows
is just an approximation, hence the inconsistent count. The other pair of values, I think, an exact number of 16KB blocks.
Since the PK is "clustered" with the data, the clustered_index_size
is the size of the data, plus some overhead for the BTree on the PK. Plus a lot of overhead and/or wasted space (as mentioned above).