I use MySQL and SQLite often and plan on bringing more PostgreSQL into my workflow soon. With that in mind, what are the costs of using NULL in each database? I heard that MySQL adds an extra bit to each NULL column value to mark it as nullable.
Asked
Active
Viewed 2,156 times
5
-
1Some DBMS treat null and empty as the same, as far as strings go (Sybase, MSSQL). For non-string types, a nullable type will always require more storage than a not-nullable type. This is because, as you've stated, you need at least a single bit to indicate whether or not the value is null or not. I suppose some DMBS may be able to compress data in some extent, but in a worst case, a nullable type will always consume more data than a non-nullable type. – Nathan Ernst Nov 30 '10 at 04:29
1 Answers
3
This question was answered separately for PostgreSQL: How much disk-space is needed to store a NULL value using postgresql DB?
and for MySQL: NULL in MySQL (Performance & Storage)
But to recap they both use bitmask fields to mark nulls.