How much space a null occupies in the database


good morning the reason for my question is more informative is about the space that occupies a field null in the database, since I have a database with several fields and sometimes I have several fields in null and I worries about the space this null field can have in my database, since I do not want to waste the memory of my server when implementing the database, when I consult about the information on the subject I find a lot of contradictory information I would like to know where you can find reliable information on the subject, also I'm using Mysql as a database engine I have attached an example of my database

I'm not very good with the database any information or correction on the subject will be received with much gratitude

asked by esteban fabian patiño 15.10.2017 в 22:29

1 answer


Fields with variable size occupy 1 byte to indicate that it is NULL.

Null values are not saved in the field itself but in the header of the record. In this header there is a pointer for each field. If the pointer is null, the field has a null value.

Fields with fixed size, whether NULL or not, occupy the same

int - 4 bytes

answered by 15.10.2017 / 22:43