Re: [RFC] Minmax indexes - Mailing list pgsql-hackers

From Andres Freund
Subject Re: [RFC] Minmax indexes
Date
Msg-id 20130617203143.GA3390@awork2.anarazel.de
Whole thread Raw
In response to Re: [RFC] Minmax indexes  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On 2013-06-17 16:23:40 -0400, Alvaro Herrera wrote:
> > > Re-summarization is relatively expensive, because the complete page range has
> > > to be scanned.
> > 
> > Why?  Why can't we just update the affected pages in the index?
> 
> The page range has to be scanned in order to find out the min/max values
> for the indexed columns on the range; and then, with these data, update
> the index.

Why? Assuming the initial summarization has been performed you can check
the current min/max value, check whether it's still smaller/bigger than
the value you're inserting and if not update the index accordingly with
the new value. You don't even need to wait for the new value to become
visible since the ranges don't need to be minimal.

I think the contention this possibly causes may a better argument, but I
am not sure how much of a problem that really becomes if we find a
deadlock free way to only lock the minmax pages exlusively if the range
is violated.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [RFC] Minmax indexes
Next
From: Alvaro Herrera
Date:
Subject: Re: [RFC] Minmax indexes