Re: Oddly slow queries

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Thomas Spreng" <spreng(at)socket(dot)ch>
Cc: "Chris Browne" <cbbrowne(at)acm(dot)org>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Oddly slow queries
Date: 2008-04-19 17:04:06
Message-ID: dcc563d10804191004l1406fe89r5e2b7ee3931a4348@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Apr 16, 2008 at 3:48 PM, Thomas Spreng <spreng(at)socket(dot)ch> wrote:
>
> On 16.04.2008, at 17:42, Chris Browne wrote:
>
> > spreng(at)socket(dot)ch (Thomas Spreng) writes:
> >
> > > On 16.04.2008, at 01:24, PFC wrote:
> > >
> > > >
> > > >
> > > > > The queries in question (select's) occasionally take up to 5 mins
> > > > > even if they take ~2-3 sec under "normal" conditions, there are no
> > > > > sequencial scans done in those queries. There are not many users
> > > > > connected (around 3, maybe) to this database usually since it's
> > > > > still in a testing phase. I tried to hunt down the problem by
> > > > > playing around with resource usage cfg options but it didn't really
> > > > > made a difference.
> > > > >
> > > >
> > > > Could that be caused by a CHECKPOINT ?
> > > >
> > >
> > > actually there are a few log (around 12 per day) entries concerning
> > > checkpoints:
> > >
> > > LOG: checkpoints are occurring too frequently (10 seconds apart)
> > > HINT: Consider increasing the configuration parameter
> > > "checkpoint_segments".
> > >
> > > But wouldn't that only affect write performance? The main problems I'm
> > > concerned about affect SELECT queries.
> > >
> >
> > No, that will certainly NOT just affect write performance; if the
> > postmaster is busy writing out checkpoints, that will block SELECT
> > queries that are accessing whatever is being checkpointed.
> >
>
> What I meant is if there are no INSERT's or UPDATE's going on it shouldn't
> affect SELECT queries, or am I wrong?

But checkpoints only occur every 10 seconds because of a high insert /
update rate. So, there ARE inserts and updates going on, and a lot of
them, and they are blocking your selects when checkpoint hits.

While adjusting your background writer might be called for, and might
provide you with some relief, you REALLY need to find out what's
pushing so much data into your db at once that it's causing a
checkpoint storm.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Browne 2008-04-19 17:11:05 Re: Oddly slow queries
Previous Message Scott Marlowe 2008-04-19 16:48:42 Re: Exact index overhead