Re: Minmax indexes

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Nicolas Barbier <nicolas(dot)barbier(at)gmail(dot)com>, "Claudio Freire" <klaussfreire(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, "Andres Freund" <andres(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Minmax indexes
Date: 2014-08-10 10:27:18
Message-ID: 53E74906.5000903@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08/10/2014 12:42 PM, Simon Riggs wrote:
> On 8 August 2014 16:03, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> wrote:
>
>> I couldn't resist starting to hack on this, and implemented the scheme I've
>> been having in mind:
>>
>> 1. MMTuple contains the block number of the heap page (range) that the tuple
>> represents. Vacuum is no longer needed to clean up old tuples; when an index
>> tuples is updated, the old tuple is deleted atomically with the insertion of
>> a new tuple and updating the revmap, so no garbage is left behind.
>>
>> 2. LockTuple is gone. When following the pointer from revmap to MMTuple, the
>> block number is used to check that you land on the right tuple. If not, the
>> search is started over, looking at the revmap again.
>
> Part 2 sounds interesting, especially because of the reduction in CPU
> that it might allow.
>
> Part 1 doesn't sound good yet.
> Are they connected?

Yes. The optimistic locking in part 2 is based on checking that the
block number on the MMTuple matches what you're searching for, and that
there is never more than one MMTuple in the index with the same block
number.

> More importantly, can't we tweak this after commit? Delaying commit
> just means less time for other people to see, test, understand tune
> and fix. I see you (Heikki) doing lots of incremental development,
> lots of small commits. Can't we do this one the same?

Well, I wouldn't consider "let's redesign how locking and vacuuming
works and change the on-disk format" as incremental development ;-).
It's more like, well, redesigning the whole thing. Any testing and
tuning would certainly need to be redone after such big changes.

If you agree that these changes make sense, let's do them now and not
waste people's time testing and tuning a dead-end design. If you don't
agree, then let's discuss that.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2014-08-10 11:48:24 Re: Patch to support SEMI and ANTI join removal
Previous Message Heikki Linnakangas 2014-08-10 10:20:09 Re: Minmax indexes