High severityexecution
Power BI Refresh Error:
SQL execution aborted: lock wait timeout
What does this error mean?
A DML statement (UPDATE, DELETE, or MERGE) was aborted because it could not acquire a lock on the target table within the allowed wait time. Another concurrent DML statement held an incompatible lock on the same table.
Common causes
- 1Two concurrent MERGE or UPDATE statements targeting the same table ran simultaneously
- 2A long-running transaction held a table lock and a second statement exceeded the lock wait timeout
- 3A failed or orphaned transaction was not rolled back, leaving a dangling lock on the table
- 4Multiple dbt models running in parallel all targeted the same incremental table
- 5A bulk load COPY INTO and a concurrent DML operation competed for the same table lock
How to fix it
- 1Run SHOW TRANSACTIONS to identify the blocking transaction and SYSTEM$ABORT_TRANSACTION to terminate it if orphaned.
- 2Increase LOCK_TIMEOUT_IN_SECONDS for the session to allow the statement to wait longer: ALTER SESSION SET LOCK_TIMEOUT_IN_SECONDS = 300.
- 3Serialize concurrent DML on the same table by using Snowflake tasks with explicit ordering or dbt thread limits.
- 4Break large MERGE operations into smaller batches keyed on a partition column to reduce lock contention.
- 5Ensure all transactions are explicitly committed or rolled back — open transactions accumulate locks indefinitely.