From: | Torsten Förtsch <torsten(dot)foertsch(at)gmx(dot)net> |
---|---|
To: | Sergey Konoplev <gray(dot)ru(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Disable an index temporarily |
Date: | 2014-04-20 08:09:24 |
Message-ID: | 535380B4.3000309@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 20/04/14 03:02, Sergey Konoplev wrote:
Thanks for you reply.
>> 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;
I know about that.
The problem is I have a number of indexes in a large system that are
very similar. And I suspect some of them are superfluous.
Example:
btree (fmb_id, action_type)
btree (fmb_id)
Action_type in this case is one out of a handful of values (should
perhaps be an ENUM but is TEXT) and for most of the table the
combination of (fmb_id, action_type) is unique. The table itself has
~2E8 rows. So it takes a while to build these indexes from scratch.
Now, we have several performance counters in place. I want to disable
these indexes one by one and see what happens. I am probably not able to
find all of the queries that use them. But I believe that nothing much
happens if I drop one of them (preferably the former?).
Torsten
From | Date | Subject | |
---|---|---|---|
Next Message | Gavin Flower | 2014-04-20 09:59:00 | Re: Disable an index temporarily |
Previous Message | Sergey Konoplev | 2014-04-20 01:02:08 | Re: Disable an index temporarily |