How To Find The Queries That Is Blocking Another Query?
I am trying to drop an empty table drop table temp; the query is running forever. So, I tried to find other queries that could block the current query. Here is what I tried: SELECT
Solution 1:
Before running DROP TABLE, execute
SELECT pg_backend_pid();
That will tell you the backend process ID. Then run DROP TABLEin the same database session.
Then, when DROP TABLE is hanging, start a new session and run
SELECT pg_blocking_pids(<backend PID>);
Then you know which sessions are blocking you, and can kill them or take less disruptive measures for getting rid of them.
Post a Comment for "How To Find The Queries That Is Blocking Another Query?"