Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do extra empty columns affect sql table size significantly?

Tags:

sql

I have a few columns that I know won't be used initially. Is it a good practice to add columns only when needed or just leave those extra columns there?

Is it just a little more space in the header or every row?


1 Answers

Depends on the column type to some extent.

Variable sized columns (such as varchar(n)) will only use 4 extra bytes (approx) per row.

I would add columns only when required, since it is less likely that redundant columns will be added and never removed.

like image 116
Mitch Wheat Avatar answered Sep 03 '25 03:09

Mitch Wheat