Lock Monitoring Query in PostgreSQL 9.6

I used to use the following query which is pretty helpful whenever I wanted to find out the queries which are in ‘waiting’ state, but after upgrading to PostgreSQL 9.6, I was unable to run that and use to get the error as shown below.

The reason for the error is that ‘waiting’ column is dropped in PostgreSQL 9.6 and is replaced by two other columns that is:

  1. wait_event  : Name of the wait event for which the backend/query is waiting on. There is a big list of wait events which can be found here.
  2. wait_event_type: The type of event for which backend/query is waiting for.  There are 4 possible values for it which can be found here.

So query will change to following if you want to find out whether it is waiting on something or not.

0 comments… add one

Leave a Comment