pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Milen A. Radev <milen@radev.net>
Cc: pgsql-admin@postgresql.org
Subject: Re: Lock Statistics
Date: Mon, 30 Jul 2007 20:20:44 -0600
Message-ID: <20070731022044.GB23999@winnie.fuhr.org> (raw)
In-Reply-To: <32c009ea0707300911h74f588f6se7d03f5f28d598e5@mail.gmail.com>
References: <32c009ea0707300911h74f588f6se7d03f5f28d598e5@mail.gmail.com>

On Mon, Jul 30, 2007 at 07:11:11PM +0300, Milen A. Radev wrote:
> I have performance problems with a DB (slow queries) and I suspect the
> main cause is that a lot of queries wait for a lock on one small
> table. That's why I need some stats about the number and (average)
> wait-time for locks (even only for this particular table).

Why do you suspect that locks are the problem?  Unless the queries
are making concurrent updates of the same row(s) locking isn't
likely to be the problem due to the way MVCC works.

Could you post one of the slow queries along with the EXPLAIN ANALYZE
output?  Are you vacuuming and analyzing your tables regularly?
What version of PostgreSQL are you running?

PostgreSQL 8.3 will have a log_lock_waits configuration setting to
log locks that wait longer than deadlock_timeout but that doesn't
help you now unless you're able and willing to run tests in a version
of PostgreSQL that's still under development (don't use it for
anything you wouldn't want to lose).

-- 
Michael Fuhr



view thread (5+ messages)  latest in thread

Message-ID: <20070731022044.GB23999@winnie.fuhr.org>
Permalink:  ../20070731022044.GB23999@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20070731022044.GB23999@winnie.fuhr.org

 · 

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-admin@postgresql.org
  Cc: mike@fuhr.org, milen@radev.net
  Subject: Re: Lock Statistics
  In-Reply-To: <20070731022044.GB23999@winnie.fuhr.org>

* 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