Re: Updating histogram_bounds after a delete

Поиск
Список
Период
Сортировка
От Derrick Rice
Тема Re: Updating histogram_bounds after a delete
Дата
Msg-id AANLkTikrVqwXp3ugoMLR8-6BOegSDByRCuTCFtGVBZ+E@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Updating histogram_bounds after a delete  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Ответы Re: Updating histogram_bounds after a delete  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-performance
On Wed, Mar 16, 2011 at 5:56 PM, Kevin Grittner <Kevin.Grittner@wicourts.gov> 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

В списке pgsql-performance по дате отправления:

Предыдущее
От: Tech Madhu
Дата:
Сообщение: Re: pg_xlog size
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Updating histogram_bounds after a delete