MySQL Forums
Forum List  »  InnoDB

InnoDB field type size vs file size descrepency?
Posted by: Eman G
Date: July 05, 2019 12:58PM

I created these tables:

create table aca (money TINYINT);
create table acb (money SMALLINT);
create table acc (money INT);
create table acd (money BIGINT);

I ran the following inserts over and over to add 9420 rows:
INSERT INTO aca (money) VALUES(7), (8), (9), (10), (12);
INSERT INTO acb (money) VALUES(7), (8), (9), (10), (12);
INSERT INTO acc (money) VALUES(7), (8), (9), (10), (12);
INSERT INTO acd (money) VALUES(7), (8), (9), (10), (12);

When I check the files on the server it shows each database being slightly larger than the other:
-rw-r----- 1 mysql mysql 360448 Jul 5 14:21 aca.ibd
-rw-r----- 1 mysql mysql 376832 Jul 5 14:21 acb.ibd
-rw-r----- 1 mysql mysql 393216 Jul 5 14:21 acc.ibd
-rw-r----- 1 mysql mysql 442368 Jul 5 14:21 acd.ibd

Since each field is twice as large as the next, I would expect each database file to be roughly twice the size (given a small difference because of headers), but this is not the case and instead of being double the size (100% larger) they are 4-13% larger.

Why?

Options: ReplyQuote


Subject
Views
Written By
Posted
InnoDB field type size vs file size descrepency?
1025
July 05, 2019 12:58PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.