Skip site navigation (1) Skip section navigation (2)

Re: Long (really long) queries and not sure how to diagnose

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tony Day <tonyd(at)panztel(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Long (really long) queries and not sure how to diagnose
Date: 2010-04-30 05:01:47
Message-ID: 13706.1272603707@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Tony Day <tonyd(at)panztel(dot)com> writes:
> We are running PostgreSQL 8.3.9 on Ubuntu 9.04 and yesterday the Postgresql
> log reported about 15 SQL queries that had taken between 30,000 and 50,000
> seconds (not ms) to execute.

> All (except one) of the queries are single Inserts to the same relatively
> simple table (no triggers or the like).

> A colleague has suggested that it might be a deadlock but my understanding
> is that Postgresql identifies deadlocks and terminates one of the queries.

> I would appreciate any suggestions of where to look and (more importantly)
> what to look for to figure this out.

Best guess from here is that some transaction took a write-preventing
lock on that table, and then sat on it for a really long time.  If this
were still going on, a look into pg_stat_activity and/or pg_locks would
quickly prove or refute that theory.  Since it's not, there's probably
not much you can do right now unless you have complete query logs to
study.  What I'd suggest is familiarizing yourself with those views
so you'll be better prepared to investigate next time.

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Tony DayDate: 2010-04-30 05:24:38
Subject: Re: Long (really long) queries and not sure how to diagnose
Previous:From: Tony DayDate: 2010-04-30 01:59:55
Subject: Long (really long) queries and not sure how to diagnose

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group