Sunday, June 8, 2008

Re: [GENERAL] temporarily deactivate an index

Viktor Rosenfeld <rosenfel@informatik.hu-berlin.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

No comments: