Re: Updating histogram_bounds after a delete - Mailing list pgsql-performance

From Kevin Grittner
Subject Re: Updating histogram_bounds after a delete
Date
Msg-id 4D81D939020000250003BA22@gw.wicourts.gov
Whole thread Raw
In response to Re: Updating histogram_bounds after a delete  (Derrick Rice <derrick.rice@gmail.com>)
Responses Re: Updating histogram_bounds after a delete  (Kenneth Marshall <ktm@rice.edu>)
Re: Updating histogram_bounds after a delete  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
Derrick Rice <derrick.rice@gmail.com> wrote:
> 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?

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

pgsql-performance by date:

Previous
From: Derrick Rice
Date:
Subject: Re: Updating histogram_bounds after a delete
Next
From: Kenneth Marshall
Date:
Subject: Re: Updating histogram_bounds after a delete