Reduce database lock contention
Diagnose database lock contention, identify the transactions involved, and fix it with shorter transactions, optimistic locking, or index improvements.
Preview
Copy prompt
My [Database] has significant lock contention on [Table / Query pattern] causing high wait times and occasional deadlocks. Here is the schema and conflicting queries: [Paste]. Identify the lock types involved and which transactions acquire conflicting locks. Suggest fixes: shortening transaction duration, switching to optimistic locking, adding a selective index to reduce the lock scope, or partitioning the hot table to distribute writes.
More
Performance
Prompts
