Quantcast
Channel: MySQL Forums - InnoDB
Viewing all articles
Browse latest Browse all 1954

InnoDB field type size vs file size descrepency? (1 reply)

$
0
0
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?

Viewing all articles
Browse latest Browse all 1954

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>