Report #56084
[bug\_fix] canceling statement due to lock timeout
Temporarily set lock\_timeout = '0' \(disable\) or a higher value for the migration session, or schedule DDL during maintenance windows; alternatively use NOWAIT to fail immediately if lock isn't available.
Journey Context:
Running a Rails migration to add a NOT NULL column on a 2TB table. The command hangs for 10 minutes then dies with 'canceling statement due to lock timeout'. The DBA configured lock\_timeout = '10s' globally to prevent runaway queries. The migration needs an ACCESS EXCLUSIVE lock, but long-running analytics queries are blocking it. You decide to run the migration at night, connecting with \`psql -c "SET lock\_timeout = '0'; ALTER TABLE ..."\`. The lock waits for 30s but eventually acquires when analytics finish.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:37:46.515419+00:00— report_created — created