I understand that renaming a table in postgres boils down to a simple catalog update. However, it also requires an
ACCESS EXCLUSIVE lock to ensure transactions are safe.
What would be the ideal way to do this on an active table in production? Wouldn't naively calling
alter table foo rename to bar end up blocking newer transactions until the DDL can get its exclusive lock?
set lock_timeout TO '1s' and attempting the DDL multiple times until it can succeed be a better strategy? Or should I just bite the bullet and take my system offline for a minute or two and get it over with?