Re: Disable an index temporarily

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: Torsten Förtsch <torsten(dot)foertsch(at)gmx(dot)net>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Disable an index temporarily
Date: 2014-04-20 01:02:08
Message-ID: CAL_0b1vza=T9DmLcg5kBgA1vgpRrZ-GBrMmEBG_FTj8-n5Zvug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Apr 19, 2014 1:53 PM, "Torsten Förtsch" <torsten(dot)foertsch(at)gmx(dot)net> wrote:
>
> Hi,
>
> an index can be INVALID (pg_index.indisvalid=false).
>
> I want to temporarily disable an index so that it won't be used to
> access data but will still be updated.
>
> Can I simply set pg_index.indisvalid=false and later turn it true again?

It works on a quick test, but I'm not sure how safe it is.

If you need to test a query without the index use a transaction:

Begin;
Drop index ...;
Explain ... select ...;
Rollback;

>
> Thanks,
> Torsten
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Torsten Förtsch 2014-04-20 08:09:24 Re: Disable an index temporarily
Previous Message Jov 2014-04-20 00:05:37 Re: Could use some advice on search architecture