Re: temporarily deactivate an index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Viktor Rosenfeld <rosenfel(at)informatik(dot)hu-berlin(dot)de>
Cc: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: temporarily deactivate an index
Date: 2008-06-08 16:45:29
Message-ID: 5190.1212943529@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Viktor Rosenfeld <rosenfel(at)informatik(dot)hu-berlin(dot)de> writes:
> That works, but I'm still looking for another way to deactivate the
> index. The reason being, that my query load is randomly generated by
> a Java program and I don't want to go and change the SQL compiler.

Well, you're going to have to change *something* on the client side,
assuming you want this behavioral change to affect only some queries.

Otherwise, in versions that have CREATE INDEX CONCURRENTLY you could
mark the index not ready to use yet (see pg_index.indisvalid or
pg_index.indisready depending on version).

Another line of attack, which I think only works in 8.3 and up,
is to make a planner plugin that disables specific indexes from
being considered. In fact I think I'd made a toy one of those
last year [ rummages... ] Yeah, here it is. Code attached.
No documentation, but basically you'd build it using pgxs and
then do
LOAD '$libdir/planignoreindex';
SET ignore_index = name-of-index;
Again this would be difficult to do without any client changes.

regards, tom lane

Attachment Content-Type Size
unknown_filename text/plain 2.4 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-06-08 17:01:54 Re: libpq.so.4
Previous Message Tino Wildenhain 2008-06-08 16:40:59 Re: PL/pgSQL graph enumeration function hangs