Skip to content

Instantly share code, notes, and snippets.

@munya
Created March 26, 2021 09:33
Show Gist options
  • Select an option

  • Save munya/e39cf47ae43dc2494997f5aa39a86739 to your computer and use it in GitHub Desktop.

Select an option

Save munya/e39cf47ae43dc2494997f5aa39a86739 to your computer and use it in GitHub Desktop.
Alter table with lock table
BEGIN;
SET statement_timeout = 50;
LOCK TABLE ONLY test IN ACCESS EXCLUSIVE MODE;
SET statement_timeout = 0;
ALTER TABLE test ....;
-- do whatever you want, timeout is removed.
commit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment