Re: Invisible Indexes

From: Andres Freund <andres(at)anarazel(dot)de>
To: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
Cc: Jaime Casanova <jaime(dot)casanova(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Invisible Indexes
Date: 2018-06-18 21:56:35
Message-ID: 20180618215635.m5vrnxdxhxytvmcm@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-06-18 17:50:44 -0400, Andrew Dunstan wrote:
>
>
> On 06/18/2018 05:46 PM, Jaime Casanova wrote:
> > On 18 June 2018 at 16:36, Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> wrote:
> > > This is a MySQL feature, where an index is not considered by the planner.
> > > Implementing it should be fairly straightforward, adding a new boolean to
> > > pg_index, and options to CREATE INDEX and ALTER INDEX. I guess VISIBLE would
> > > become a new unreserved keyword.
> > >
> > > The most obvious use case is to see what the planner does when the index is
> > > not visible, for example which other index(es) it might use. There are
> > > probably other cases where we might want an index to enforce a constraint
> > > but not to be used in query planning.
> > >
> > > So, do we want this feature? If we do I'll go ahead and prepare a patch.
> > >
> > should pg_index.indisvalid works for this? in that case you only need
> > the syntax for it...
> >
>
>
> I thought about that. But I think these are more or less orthogonal.  I
> doubt it will involve lots of extra code, though.

Be careful about that - currently it's not actually trivially possible
to ever update pg_index rows. No, I'm not kidding
you. pg_index.indexcheckxmin relies on the pg_index row's xmin. If you
have ALTER do a non inplace update, you'll break things.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-06-18 21:57:04 Re: Invisible Indexes
Previous Message Peter Geoghegan 2018-06-18 21:54:09 Re: [WIP] [B-Tree] Retail IndexTuple deletion