Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does empty text occupy space in database

Does empty text(type) occupy space in database ? One column of database table is merely used, if data is inserted in this column, the size will be no more than 2 digit integer. First-fall, I set int(2) for this column, but it kept 0 value even if it is empty. No matter how much, but space is occupied even there is 0 value. Am I right ? So I switch int to text thinking that text field would be empty if no data is inserted. Is my assumption right ? Does empty text occupy space ?

like image 670
Dipak Avatar asked Jun 08 '26 17:06

Dipak


1 Answers

Blank space will take minimal space : i) one bit in the NULL bitmap ii) two bytes for length (which will be zero when NULL.

like image 156
Manmeet Avatar answered Jun 10 '26 08:06

Manmeet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!