Re: [HACKERS] Multicolumn hash indexes - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: [HACKERS] Multicolumn hash indexes
Date
Msg-id CAPpHfdvY9eDTW4sk2ocvwbGtdoFm8Oke=6VrO0rUE2GOUhnnWA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Multicolumn hash indexes  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Fri, Sep 29, 2017 at 6:33 PM, Robert Haas <robertmhaas@gmail.com> wrote:
Now you could also imagine something where we keep a separate set of
hash buckets for each column and multi-column searches are handled by
searching each hash table separately and taking the intersection of
the sets of TIDs found for each column.  Not sure that's a good idea,
but it's sort of like what GIN does.

I'd like to note that what GIN does for multicolumn indexes seems quite artificial thing to me.  Logically multicolumn GIN index is the same thing as multiple singlecolumn GIN indexes.  The reason why multicolumn GIN exists is the fact that in particular case GIN does overlapping of scan results over multiple attributes more efficient than our executor do.  Particular case is that scans over multiple columns return ordered sets of TIDs.  GIN implements kind of merge join over TIDs while our executor can only do BitmapAnd in this case.

However, if we imagine that at the moment we develop GIN our executor can do merge join of TIDs produced by multiple index scans, then we wouldn't invent multicolumn GIN at all. Or probably we would invent very different kind of multicolumn GIN.

I mean that multicolumn GIN was a good solution of particular problem from practical side of view.  It allowed to implement very efficient algorithms with minimal changes in planner/executor infrastructure.  However, multicolumn GIN doesn't look like a good design pattern we would like to repeat.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company 

pgsql-hackers by date:

Previous
From: Nico Williams
Date:
Subject: [HACKERS] Re: COMMIT TRIGGERs, take n+1
Next
From: Alexander Korotkov
Date:
Subject: Re: [HACKERS] [PATCH]make pg_rewind to not copy useless WAL files