Tech
What Actually Happens When You UPDATE a Row in PostgreSQL?
Most developers think of a PostgreSQL table like this:
users
id | age
1 | 25
2 | 31
3 | 42
Then we run:
UPDATE users
SET age = 30
WHERE id = 1;
The obvious mental model is:
25 β 30
But PostgreSQL doesn't simply overwrite the old value.
To understand what actually happens, we need to look at how PostgreSQL stores rows and how MVCC (Multi-Version Concurrency Control) works.
Tables are stored as pages
PostgreSQL stores table data in fi...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to