Re: [HACKERS] Proposal: Local indexes for partitioned table

From: Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Robert Haas <robertmhaas(at)gmail(dot)com>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Maksim Milyutin <milyutinma(at)gmail(dot)com>
Subject: Re: [HACKERS] Proposal: Local indexes for partitioned table
Date: 2018-01-08 20:47:15
Message-ID: 3cc142e1-82c7-0d47-681b-59d519606f4e@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Alvaro,

On 01/08/2018 03:36 PM, Alvaro Herrera wrote:
> Jesper Pedersen wrote:
>
>> Maybe a warning for existing indexes on the same column(s), but with a
>> different type, should be emitted during ATTACH, e.g.
>
>> [detach one partition, replace index with a different one, attach
>> partition]
>
>> Of course, this could also fall under index maintenance and no warning
>> emitted. Docs have "Each partition is first checked to determine whether an
>> equivalent index already exists," so it is covered.
>
> Yeah, I'm of two minds about this also -- in the initial versions I had
> a code comment wondering exactly about having a hash index in a
> partition attached to a btree index on parent.
>
> As another example, having a documents table with two partitions (one
> "long term archival" and other "documents currently being messed with")
> you could have a text search index which is GIN in the former and GiST
> in the latter. There is a performance argument for doing it that way,
> so it's not merely academic.
>
> Anyway, while I think attaching an index that doesn't match the
> properties of the index on parent can be a useful feature, on the other
> hand it could be surprising (you end up losing an index because it was
> matched during attach that you didn't think was going to be matched).
> One idea would be to have a way to specify at ATTACH time what to do
> about indexes when they don't match exactly, but I think the user
> interface would be pretty messy: exactly how different do you want to
> allow the indexes to be? Is an index having one more column than the
> one in parent good enough? I think the answer to this is mostly a
> judgement call, and I'd rather not spend my time debating those.
>

Yeah, agreed - lets leave as is.

Migrating an index to another type would mean to drop the top-level
definition anyway.

Best regards,
Jesper

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-01-08 20:54:59 Re: [HACKERS] Proposal: Local indexes for partitioned table
Previous Message Tom Lane 2018-01-08 20:45:02 Re: Condition variable live lock