Re: disabling an index without deleting it?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: "Markus Bertheau" <mbertheau(dot)pg(at)googlemail(dot)com>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, "Peter Koczan" <pjkoczan(at)gmail(dot)com>, "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>, "pgsql-performance" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: disabling an index without deleting it?
Date: 2008-02-27 23:00:17
Message-ID: 10385.1204153217@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> Out of curiosity, couldn't any transaction using a snapshot prior to
> the commit of the DROP continue to use it (just like an uncommited
> DELETE of a row)? The transaction doing the DROP wouldn't maintain
> it for modifications, which is fine whether it is committed or
> rolled back. There would just be the matter of "vacuuming" the
> index out of physical existence once all transactions which could
> see it are gone.

You can't just lazily remove the index after the last xact stops using
it; there has to be an agreed synchronization point among all the
transactions. Otherwise you could have xact A expecting the index to
contain entries from the already-committed xact B, but B thought the
index was dead and didn't bother updating it.

We might be able to do something that would shorten the length of time
that the exclusive lock is held, but AFAICS we couldn't eliminate it
altogether; and I'm unconvinced that merely shortening the interval
is worth much extra complexity.

In the particular case at hand, a planner hook to make it ignore the
index is a far better solution anyway...

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Grittner 2008-02-27 23:18:50 Re: disabling an index without deleting it?
Previous Message Kevin Grittner 2008-02-27 20:50:10 Re: disabling an index without deleting it?