Re: locking issue on simple selects?

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: Tobias Brox <tobixen(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)postgresql(dot)org
Subject: Re: locking issue on simple selects?
Date: 2010-09-15 19:28:24
Message-ID: 4C911E58.6030605@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Tobias Brox wrote:
> I thought so, we have a logging script that logs the content of
> the pg_locks table, it didn't log anything interesting but it may be a
> problem with the script itself. It does an inner join on
> pg_locks.relation = pg_class.oid but when I check now this join seems
> to remove most of the rows in the pg_locks table.

Some of the waits you might be running into will be things waiting on
another transaction holding a lock to finish, which are probably wiped
out by this approach. There are some useful examples of lock views on
the wiki:

http://wiki.postgresql.org/wiki/Lock_Monitoring
http://wiki.postgresql.org/wiki/Lock_dependency_information
http://wiki.postgresql.org/wiki/Find_Locks

And the idea you have of coverting the pg_class one to an outer join
will help.

The other thing you should try is toggling on log_lock_waits and
possibly reducing deadlock_timeout. This will put a lot of the
information you're trying to collect right into the logs.

--
Greg Smith, 2ndQuadrant US greg(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services and Support www.2ndQuadrant.us
Author, "PostgreSQL 9.0 High Performance" Pre-ordering at:
https://www.packtpub.com/postgresql-9-0-high-performance/book

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Brad Nicholson 2010-09-15 19:32:56 Re: locking issue on simple selects?
Previous Message Tom Lane 2010-09-15 19:21:18 Re: locking issue on simple selects?