Re: Slow queries after vacuum analyze - Mailing list pgsql-performance

From Kevin Grittner
Subject Re: Slow queries after vacuum analyze
Date
Msg-id 20121221153413.144660@gmx.com
Whole thread Raw
In response to Slow queries after vacuum analyze  (Ghislain ROUVIGNAC <ghr@sylob.com>)
List 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


pgsql-performance by date:

Previous
From: Charles Gomes
Date:
Subject: Re: Performance on Bulk Insert to Partitioned Table
Next
From: Richard Neill
Date:
Subject: Re: Why does the query planner use two full indexes, when a dedicated partial index exists?