FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Which ALTER TABLE Operations Lock Your PostgreSQL Table?
NewsSystems

Which ALTER TABLE Operations Lock Your PostgreSQL Table?

via Dev.toMickel Samuel14h ago

ALTER TABLE is not a single operation. PostgreSQL has dozens of ALTER TABLE sub-commands, and they acquire different lock levels. Some are instant and harmless. Others lock your entire table and block all traffic. This is the complete reference. ACCESS EXCLUSIVE Operations (Block Everything) These ALTER TABLE operations acquire ACCESS EXCLUSIVE, which blocks all reads and writes on the table. On a busy production table, these are the operations most likely to cause outages. ADD COLUMN with volatile DEFAULT -- Rewrites the entire table (all PostgreSQL versions) ALTER TABLE users ADD COLUMN request_id UUID DEFAULT gen_random_uuid(); -- Safe alternative: three-step pattern ALTER TABLE users ADD COLUMN request_id UUID; ALTER TABLE users ALTER COLUMN request_id SET DEFAULT gen_random_uuid(); -- Backfill in batches... On PostgreSQL 11+, non-volatile defaults (constants like 'active' , 0 , false ) are instant and do not rewrite the table. Volatile defaults ( now() , gen_random_uuid() , random

Continue reading on Dev.to

Opens in a new tab

Read Full Article
4 views

Related Articles

BlipBlox After Dark Review: a Synthesizer for Everybody
News

BlipBlox After Dark Review: a Synthesizer for Everybody

Wired • 8h ago

Lenovo's new PCs offer a glimpse of the future - and it's modular
News

Lenovo's new PCs offer a glimpse of the future - and it's modular

ZDNet • 8h ago

Remote Control Is the Last Piece. Anthropic’s Agent Stack Is Now Complete.
News

Remote Control Is the Last Piece. Anthropic’s Agent Stack Is Now Complete.

Medium Programming • 9h ago

News

You can't always fix it

Lobsters • 9h ago

Engineering Managers Ask “Will It Scale?” Product Managers Ask “Will It Matter?”
News

Engineering Managers Ask “Will It Scale?” Product Managers Ask “Will It Matter?”

Medium Programming • 9h ago

Discover More Articles