MySQL Forums
Forum List  »  General

Why does this table take 10x the disk space in MySQL compared to SQL Server?
Posted by: Luther Avery
Date: July 19, 2016 05:12PM

I've noticed that a table can take 10 times more disk space in MySQL compared to SQL Server. I found this by creating tables in each database with 100 columns and 1000 rows:

-The MySQL one has 100 nullable columns of type TEXT
-The SQL Server one has 100 nullable columns of type VarChar(MAX)
-Each has a primary key of type INT

I then inserted 1000 rows with GUIDS in all columns for both databases. Here are the results I got:

MySQL: 499 MB
SQL Server: 41MB
Why is this so different between the two databases? I see the same result even when I do this test on new, empty databases.

Here's the MySQL table definition I used:

create table data1(
id MEDIUMINT NOT NULL AUTO_INCREMENT,
column1 text null,
column2 text null,
column3 text null,
-- ...
column99 text null,
column100 text null,
PRIMARY KEY (id))


And here's the SQL Server one:

create table data1(id int IDENTITY(1,1) PRIMARY KEY,
column1 varchar(max) null,
column2 varchar(max) null,
column3 varchar(max) null,
-- ...
column99 varchar(max) null,
column100 varchar(max) null)

Options: ReplyQuote


Subject
Written By
Posted
Why does this table take 10x the disk space in MySQL compared to SQL Server?
July 19, 2016 05:12PM


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.