I wrote about the Postgres side of this in September, in One long SELECT, one ALTER TABLE, and every query behind them . This one adds MySQL 8.4 and measures what a lock timeout with retries costs the other clients.
Adding a nullable column is one of the cheapest schema changes there is. In Postgres 18 it only touches the catalog, and in MySQL 8.4 you can ask for ALGORITHM=INSTANT . On an idle table both took a few milliseconds in my tests. What I wanted to know is what happens to everyone else when the table isn't idle, specifically when some other session has an open transaction that read from it and hasn't committed yet.
The setup
Postgres 18.6 and MySQL 8.4.13 in two throwaway Docker containers on a Mac laptop. Each had one table, items , with 200,000 rows.…