Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the cost of using NULL in database columns?

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.

like image 265
Xeoncross Avatar asked Oct 26 '22 01:10

Xeoncross


1 Answers

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.

like image 85
nate c Avatar answered Nov 15 '22 10:11

nate c