pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Smith <greg@2ndquadrant.com>
To: Tobias Brox <tobixen@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: locking issue on simple selects?
Date: Wed, 15 Sep 2010 15:28:24 -0400
Message-ID: <4C911E58.6030605@2ndquadrant.com> (raw)
In-Reply-To: <AANLkTikzssP3AKeQhM+tB_8tScRGs2iGSqTJJUg2w3DP@mail.gmail.com>
References: <AANLkTikh++7mouBb7cr2C9zMPKtRffVxDK0QFTf16HLo@mail.gmail.com>
	<4096.1284557987@sss.pgh.pa.us>
	<AANLkTikzssP3AKeQhM+tB_8tScRGs2iGSqTJJUg2w3DP@mail.gmail.com>

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@2ndQuadrant.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




view thread (12+ messages)  latest in thread

Message-ID: <4C911E58.6030605@2ndquadrant.com>
Permalink:  ../4C911E58.6030605@2ndquadrant.com/
Also on:    postgresql.org/message-id/4C911E58.6030605@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: greg@2ndquadrant.com, tobixen@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: locking issue on simple selects?
  In-Reply-To: <4C911E58.6030605@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox