Re: Updating histogram_bounds after a delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 16, 2011 at 5:56 PM, Kevin Grittner <Kevin.Grittner@xxxxxxxxxxxx> wrote:
there is a feature to probe the end of an index's range in
situations where data skew was often causing less than optimal plans
to be chosen.

Was this introduced in 9.0 or was it earlier?  My company hasn't introduced integrated support for 9.0 yet, but I can go to 8.4.

It was suggested that I change my SQL from:

delete from my_table where event_date < now() - interval '12 hours';

to:

delete from my_table where event_date < now() - interval '12 hours'
and event_date >= (select min(event_date) from my_table);

Which, even if the stats are out of date, will be more accurate as it will not consider the histogram buckets that are empty due to previous deletes.  Seems like exactly what the feature you mentioned would do, no?

Thanks for the help,

Derrick

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux