Inheritance

ALTER TABLE ... NO INHERIT

Lock mode ACCESS EXCLUSIVE
Risk HIGH
Blocks reads, writes, other DDL
pgfence rule no-inherit
ALTER TABLE orders_archive NO INHERIT orders;

What this does

Brief but ACCESS EXCLUSIVE on both parent and child. Verify no application code or query planner assumption depends on the inheritance relationship before removing it.

Safe rewrite

Schedule in a maintenance window with an explicit lock_timeout

SET lock_timeout = '2s';
ALTER TABLE orders_archive NO INHERIT orders;

Read more

More in Inheritance