Skip site navigation (1) Skip section navigation (2)

Re: determining which operation is blocking another query

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Sriram Dandapani <sdandapani(at)counterpane(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: determining which operation is blocking another query
Date: 2006-05-25 07:27:07
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
On Wed, May 24, 2006 at 11:49:37PM -0700, Sriram Dandapani wrote:
> Is there a system view that can be used to determine which
> INSERT/UPDATE/DELETE/Other Operation is blocking a SELECT statement.

Query pg_locks to see what locks transactions have acquired or are
waiting to acquire.  If you have stats_command_string enabled then
querying pg_stat_activity should show sessions' current queries.

Are you sure SELECT is blocked, or could it just be taking a long
time?  MVCC allows SELECT to run concurrently with INSERT, UPDATE,
and DELETE without blocking; only a few operations like VACUUM FULL
block an ordinary SELECT (without FOR SHARE or FOR UPDATE).

Michael Fuhr

In response to

pgsql-admin by date

Next:From: Adam RadlowskiDate: 2006-05-25 10:59:14
Subject: Re: defining Your own sort order for already compiled PostgreSQL
Previous:From: Sriram DandapaniDate: 2006-05-25 06:49:37
Subject: determining which operation is blocking another query

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group