Nullable vs Non-Nullable Columns and Adding Not Null Without Downtime in PostgreSQL


In this article, we are going to talk about nullable and non-nullable columns specifically related to Postgres databases. While the reasons to use nullable or non-nullable columns may seem obvious at first, there are pitfalls associated with each decision that either affect development velocity, affect application performance, or cause downtime.

Let’s start with definitions. Nullable and non-nullable columns are terms used to describe the ability of a column in a database table to accept or not accept null values. ‘NULL’ represents unknown or missing data. ‘NULL’ is not the same as an empty string or the number zero. For example,