Re: Slow queries after vacuum analyze

From: "Kevin Grittner" <kgrittn(at)mail(dot)com>
To: "Ghislain ROUVIGNAC" <ghr(at)sylob(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow queries after vacuum analyze
Date: 2012-12-21 15:34:13
Message-ID: 20121221153413.144660@gmx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Ghislain ROUVIGNAC wrote:

>> I would leave default_statistics_target alone unless you see a lot of
>> estimates which are off by more than an order of magnitude. Even then, it
>> is often better to set a higher value for a few individual columns than for
>> everything.
>
>
> We had an issue with a customer where we had to increase the statistics
> parameter for a primary key.
> So I'd like to know if there is a way to identify for which column we have
> to change the statistics.

I don't know a better way than to investigate queries which seem to
be running longer than you would expect, and look for cases where
EXPLAIN ANALYZE shows an estimated row count which is off from
actual by enough to cause a problem. Sometimes this is caused by
correlations between values in different columns, in which case a
higher target is not likely to help; but sometimes it's a matter
that there is an uneven distribution among values not included in
the "most common values", in which case boosting the target to
store more values and finer-grained information on ranges will be
exactly what you need.

-Kevin

Browse pgsql-performance by date

  From Date Subject
Next Message Richard Neill 2012-12-22 17:29:03 Re: Why does the query planner use two full indexes, when a dedicated partial index exists?
Previous Message Charles Gomes 2012-12-21 14:30:07 Re: Performance on Bulk Insert to Partitioned Table