Re: database locks

From: "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at>
To: "Tomasz Rakowski *EXTERN*" <mourawi(at)yahoo(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: database locks
Date: 2007-03-15 10:49:46
Message-ID: AFCCBB403D7E7A4581E48F20AF3E5DB201B4AE62@EXADV1.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Douglas McNaught 2007-03-15 11:38:25 Re: Automating access grants
Previous Message Albe Laurenz 2007-03-15 10:41:18 Re: quoted identifier behaviour