Re: Slow SELECTS after large update cycle

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Jan de Visser <jdevisser(at)digitalfairway(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow SELECTS after large update cycle
Date: 2006-03-15 23:21:27
Message-ID: 1142464887.3859.195.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, 2006-03-15 at 14:39 -0500, Jan de Visser wrote:

> After fixing the hanging problems I reported here earlier (by uninstalling
> W2K3 SP1), I'm running into another weird one.
>
> After doing a +/- 8hr cycle of updates and inserts (what we call a 'batch'),
> the first 'reporting' type query on tables involved in that write cycle is
> very slow. As an example, I have a query which according to EXPLAIN ANALYZE
> takes about 1.1s taking 46s. After this one hit, everything is back to
> normal, and subsequent executions of the same query are in fact subsecond.
> Restarting the appserver and pgsql does not make the slowness re-appear, only
> running another batch will.
>
> During the 'write'/batch cycle, a large number of rows in various tables are
> inserted and subsequently (repeatedly) updated. The reporting type queries
> after that are basically searches on those tables.
>
> Anybody any ideas?

This is caused by updating the commit status hint bits on each row
touched by the SELECTs. This turns the first SELECT into a write
operation.

Try running a scan of the whole table to take the hit before you give it
back to the users.

Best Regards, Simon Riggs

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Grittner 2006-03-15 23:34:33 Re: [HACKERS] BETWEEN optimizer problems with single-value
Previous Message Chris 2006-03-15 23:11:55 Re: Slow SELECTS after large update cycle