Does using a NULL value save you space?

When saving data you may have wondered if converting a null value to another character i.e. a space, impacts disk space usage in your database.

Why would you convert a null to a space or dash? Well some people/organizations, rightly or wrongly, prefer this for reporting purposes or some other business requirement.

OK, lets review 3 common storage types, int, char and varchar:

INT


As we can see, there is no storage difference when storing a null and a single int value.

CHAR


Again, there is no storage difference when storing a null and a single int value.

VARCHAR

Finally we get a difference of 3 bytes when using a null rather than another character when using varchar.

Conclusion, not all data types allow for space savings when using nulls.

Leave a Reply