Re: Long (really long) queries and not sure how to diagnose - Mailing list pgsql-novice

From Tom Lane
Subject Re: Long (really long) queries and not sure how to diagnose
Date
Msg-id 13706.1272603707@sss.pgh.pa.us
Whole thread Raw
In response to Long (really long) queries and not sure how to diagnose  (Tony Day <tonyd@panztel.com>)
List pgsql-novice
Tony Day <tonyd@panztel.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

pgsql-novice by date:

Previous
From: Tony Day
Date:
Subject: Long (really long) queries and not sure how to diagnose
Next
From: Tony Day
Date:
Subject: Re: Long (really long) queries and not sure how to diagnose