On Mon, Nov 15, 2010 at 10:03 AM, Vick Khera <vivek@khera.org> wrote:
On Mon, Nov 15, 2010 at 5:15 AM, Willy-Bas Loos <willybas@gmail.com> wrote: > I was looking for what exactly "waiting" means in pg_stat_activity.
You can find out exactly what you're waiting for by correlating this to the pg_locks table.
Grab the 'procpid' of your waiting query and run:
select * from pg_locks where pid=<thepid> and granted='f';
Notice, in the pg_locks table, the logic works slightly different... if you're 'waiting' (pg_stat_activity), then you haven't been 'granted' (pg_locks).