4 ms·
"allowing you to not only add a column without locking the table" To be more clear, the actual advantage is that adding a column in postgres is an O(1) operati
by jeffdavis 14y ago
"allowing you to not only add a column without locking the table"
To be more clear, the actual advantage is that adding a column in postgres is an O(1) operation if the default value is NULL. It still requires taking a lock, but for many workloads you won't notice it. You still need to be aware of it though, because it can cause problems if you have long-running transactions.