Re: ANALYZE and index/stats degradation

From: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>
To: "Gregory Stark" <stark(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ANALYZE and index/stats degradation
Date: 2007-07-02 13:07:13
Message-ID: 4486.125.24.240.137.1183381633.squirrel@webmail.xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, July 2, 2007 18:15, Gregory Stark wrote:

>> So I suppose the planner has a good reason to ignore the index at that
>> point. I'm assuming that this is something to do with the correlation
>> between the index and the column's statistics degrading in some way.
>
> Best to post "explain analyze <query>" for when the performance is good
> and
> bad. Perhaps also an explain analyze for the query with enable_seqscan off
> when it's bad.

Can't easily do that anymore... AFAIR the plans were all identical
anyway, except in the "enable_seqscan bad" case which used a sequential
scan instead of using the index. The queries are very simple, along the
lines of "select * from foo where id >= x and id < y".

> Also, which version of Postgres is this?

It was an 8.2 version.

> It's possible you just need vacuum to run more frequently on this table
> and
> autovacuum isn't doing it often enough. In which case you might have a
> cron
> job run vacuum (or vacuum analyze) on this table more frequently.

Actually, come to think of it, I don't think I'd want any vacuums at all
on this particular table. Just the analyze on the primary key, no
vacuums, no statistics on anything else. Unfortunately it's not just one
table, but a set of tables that can be created dynamically. I could
change that, but in this particular case I don't think I should.

Jeroen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2007-07-02 15:17:20 Re: ANALYZE and index/stats degradation
Previous Message Gregory Stark 2007-07-02 11:15:43 Re: ANALYZE and index/stats degradation