Re: database locks - Mailing list pgsql-general

From Albe Laurenz
Subject Re: database locks
Date
Msg-id AFCCBB403D7E7A4581E48F20AF3E5DB201B4AE62@EXADV1.host.magwien.gv.at
Whole thread Raw
In response to database locks  (Tomasz Rakowski <mourawi@yahoo.com>)
List pgsql-general
Tomasz Rakowski wrote:
> I'm facing frustrating problem with locking in
> postgres server. I have application which do update
> one table few thousands time each minute. From time to
> time call to database is locked and is waiting for something
> (In pgAdmin3 in 'Server Status' window in 'Lock' tab I
> can see UPDATE statement siting there for hours... and
> usually it is the the only lock! ) At the same time I
> can connect to database from other applications
> (including pgAdmin3) and do any query on that table.

SELECT statements are never blocked by row locks, so the
latter is not surprising.

The first step is probably to find out what holds the lock for
such a long time:

When the hang occurs, do a 'SELECT * FROM pg_locks', that should
show you which backend is waiting for the lock and which backend
holds it. If you have stats_command_string set to on, you will
see the executing statement in pg_stat_activity.

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: quoted identifier behaviour
Next
From: Douglas McNaught
Date:
Subject: Re: Automating access grants