Re: Use my (date) index, darn it!

From: John Siracusa <siracusa(at)mindspring(dot)com>
To: Postgres Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Use my (date) index, darn it!
Date: 2004-01-05 18:15:56
Message-ID: BC1F140C.71330%siracusa@mindspring.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 1/5/04 11:45 AM, Christopher Browne wrote:
> It sounds to me as though the statistics that are being collected
> aren't "good enough." That tends to be a sign that the quantity of
> statistics (e.g. - bins in the histogram) are insufficient.
>
> This would be resolved by changing the number of bins (default of 10)
> via "ALTER TABLE FOO ALTER COLUMN BAR SET STATISTICS 100" (or some
> other value higher than 10).

I did that, but I wasn't sure what value to use and what column to increase.
I believe I increased the date column itself to 50 or something, but then I
wasn't sure what to do next. I re-analyzed the table with the date column
set to 50 but it didn't seem to help, so I resorted to clustering.

> Clustering would rearrange the contents of the table, and perhaps make
> the histogram 'more representative.' Increasing the "SET STATISTICS"
> value will quite likely be even more helpful, and is a lot less
> expensive than clustering the table...

What column(s) should I increase? Do I have to do anything after increasing
the statistics, or do I just wait for the stats collector to do its thing?

-John

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Bruno Wolff III 2004-01-05 18:38:59 Re: deferred foreign keys
Previous Message Christopher Browne 2004-01-05 16:45:54 Re: Use my (date) index, darn it!