Re: Is there a way to temporarily disable a index - Mailing list pgsql-hackers

From Michael Banck
Subject Re: Is there a way to temporarily disable a index
Date
Msg-id 20140711161206.GA5192@raptor.chemicalconnection.dyndns.org
Whole thread Raw
In response to Re: Is there a way to temporarily disable a index  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Is there a way to temporarily disable a index
List pgsql-hackers
On Fri, Jul 11, 2014 at 11:07:21AM -0400, Tom Lane wrote:
> David G Johnston <david.g.johnston@gmail.com> writes:
> > Benedikt Grundmann wrote
> >> That is it possible to tell the planner that index is off limits
> >> i.e.
> >> don't ever generate a plan using it?
> 
> > Catalog hacking could work but not recommended (nor do I know the
> > proper
> > commands and limitations).  Do you need the database/table to accept
> > writes
> > during the testing period?
> 
> Hacking pg_index.indisvalid could work, given a reasonably recent PG.
> I would not try it in production until I'd tested it ;-)

I wonder whether this should be exposed at the SQL level?  Hacking
pg_index is left to superusers, but the creator of an index (or the
owner of the schema) might want to experiment with disabling indices
while debugging query plans as well.

Turns out this is already in the TODO, Steve Singer has requested this
(in particular, "ALTER TABLE ...  ENABLE|DISABLE INDEX ...") in
http://www.postgresql.org/message-id/87hbegz5ir.fsf@cbbrowne.afilias-int.info
(as linked to from the TODO wiki page), but the neighboring discussion
was mostly about FK constraints.

Thoughts?


Michael



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Allow multi-byte characters as escape in SIMILAR TO and SUBSTRING
Next
From: David Johnston
Date:
Subject: Re: Is there a way to temporarily disable a index