Re: Updating histogram_bounds after a delete

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Derrick Rice" <derrick(dot)rice(at)gmail(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Updating histogram_bounds after a delete
Date: 2011-03-17 14:49:45
Message-ID: 4D81D939020000250003BA22@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kenneth Marshall 2011-03-17 14:55:29 Re: Updating histogram_bounds after a delete
Previous Message Michael Andreasen 2011-03-17 14:25:16 Fastest pq_restore?