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)