I have a MySQL database and I'd like to know if I have a VARCHAR(32) with no data inside it, does it take any space, like some
NULL values occupy space for the
NULL flag. In addition, any fixed component of the data type is also stored. For a
VARCHAR() that is the length component, which is either 1 or 2 bytes.
The storage requirement for
VARCHAR() is explained in the documentation. For
VARCHAR(32) the length is stored as a single byte.
Arrgh. I forgot that in MySQL, this depends on the storage engine. The above is true for MyISAM. It is different for InnoDB. Here is a good answer.