SELECT * FROM pg_stat_activity WHERE state = 'active';
to see active queries that might be involved in the deadlock.pg_log
directory within the data directory) for detailed error messages and the queries involved in the deadlock.SELECT relation::regclass, * FROM pg_locks WHERE NOT GRANTED;
to see which queries are waiting for locks, which can help identify the sources of the deadlock.SELECT pg_cancel_backend(pid);
to gently cancel a query using its PID, or SELECT pg_terminate_backend(pid);
to forcefully terminate the backend process if canceling doesn't work. Replace pid
with the process ID of the query involved in the deadlock.EXPLAIN
or EXPLAIN ANALYZE
with the queries to understand their execution plans and identify potential optimizations.Let Dr. Droid create custom investigation plans for your infrastructure.
Start Free POC (15-min setup) →