Skip to main content

require-statement-timeout

problem

A statement_timeout helps prevent long migrations that consume too many database resources.

solution

Configure a statement_timeout at the beginning of your migration file:

-- error, missing statement timeout
alter table t add column c boolean;
-- ok, statement timeout configured before ddl operations
set statement_timeout = '5s';
alter table t add column c boolean;

alternatively

If your database connection is already configured with a statement timeout, you can safely ignore this rule.

See require-lock-timeout for the related lock_timeout check.