Re: query is taking longer time after a while

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: query is taking longer time after a while
Date: 2009-09-29 13:35:34
Message-ID: 20090929133534.GK5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Sep 29, 2009 at 03:13:49PM +0200, Brian Modra wrote:
> 2009/9/29 Sam Mason <sam(at)samason(dot)me(dot)uk>:
> > Plain vacuum should allow things to reach a steady state after
> > a while,
>
> If there are a lot of deletes, then likely the index parameters are
> not the best.

My interpretation of the OPs problem was that the inserts and deletes
were happening at similar rates. Thus this won't be a problem.

> ANALYSE yourtable;
>
> Then, reindex (or create new index followed by drop index and rename -
> if you want to leave the index online.

Analyse is just about collecting statistics for the planner, I'm not
sure why you'd want to run it before a reindex. Autovacuum was being
run, so it's not going to make much difference is it?

> > Why not just do:
> >
> > REINDEX TABLE yourbigtable;
>
> Thats OK if the table can be taken offline. REINDEX locks the index
> while in progress.

Good point, forgot about that.

--
Sam http://samason.me.uk/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2009-09-29 13:48:23 Re: query is taking longer time after a while
Previous Message Iain Barnett 2009-09-29 13:31:05 Re: variables in ad hoc queries