PostgreSQL

Long-running transactions cause lock queue buildup

warning
performanceUpdated Jan 25, 2026
Technologies:
How to detect:

Transactions holding locks for extended periods (multiple seconds) cause other transactions to queue up waiting for lock acquisition, degrading query performance

Recommended action:

Keep transactions under 1 second whenever possible. Fetch data outside the transaction, validate in application code, then perform updates in a tight transaction. Split long transactions into smaller atomic units where business logic permits.