Derrick Rice <derrick(dot)rice(at)gmail(dot)com> wrote:
> Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)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?
I don't remember when it was added. I took a stab at searching for
it, but didn't get it figured out; if nobody who knows off-hand
jumps in, I'll try again when I have more time.
> 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);
That seems like a reasonable workaround.
> Seems like exactly what the feature you mentioned would do, no?
I know it helps with inserts off the end of the range; I'm less
certain about deletes. I *think* that's covered, but I'd have to
dig into the code or do some testing to confirm.
-Kevin