Re: Inconsistent query performance

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Ramsey Gurley <rgurley(at)smarthealth(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Inconsistent query performance
Date: 2013-04-09 03:46:42
Message-ID: CAMkU=1w31S0L0bz93jzqOA1Msxn-KAnhpGZDaVc+qUqeXaQ70Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday, April 8, 2013, Ramsey Gurley wrote:

> Hi all,
>
> I'm having issues with slow queries using postgres, and I'm finding some
> of the issues difficult to reproduce. My application logs slow queries for
> me, but often, when I go back to run explain analyze on the query it is
> very fast. I assume this is due to some sort of caching. Here is an example:
>
> sqlLogging _valuesForSQL ran 116509ms with sql string:
>

I think that your IO subsystem is getting congested on occasion, and that
you have a "selection bias". You are seeing in your log the occasions on
which it is running slow, but not seeing the occasions it is running fast.
When you run it manually, you see a result similar to the (invisible, but
frequent) times that it did not run slow.

You should monitor with sar, or iostat, or vmstat, or similar.

Cheers,

Jeff

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrien Besson 2013-04-09 09:13:39 Tablename.columnname%TYPE in Types On PostgreSQL 9.2
Previous Message Ascot Moss 2013-04-09 02:45:59 PostgreSQL 9.1.8 Upgrade to 9.1.9