Menu

1 / 2

Adding a column while another transaction is open

DEV Community: mysql·Remdore·5 days ago
#yVG7P44P
#devtomysql#devto#dev#table#transaction
Long article (1200 words) — no AI summary yet.
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.