From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Neil Conway <neilc(at)samurai(dot)com> |
Cc: | "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Async commands (like drop index) |
Date: | 2007-05-18 17:29:35 |
Message-ID: | 20070518172934.GA15691@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Neil Conway wrote:
> On Fri, 2007-18-05 at 11:47 -0500, Jim C. Nasby wrote:
> > Assuming the concurrent psql stuff gets in, do you still see a use for
> > this?
>
> I think concurrent psql (and/or async libpq) is the right way to handle
> this sort of requirement. "DROP INDEX NOWAIT" is hacky, and would be
> difficult (impossible?) to implement in a reasonable manner: the backend
> is fundamentally single-threaded. Also, how does the client learn when
> the DROP INDEX actually finishes? The client would either need to poll
> the database, or we'd need to implement something like select() --
> neither is a very appealing alternative.
I think what Joshua really wants is an equivalent of this:
start:
BEGIN;
LOCK TABLE foo IN ACCESS EXCLUSIVE MODE NOWAIT;
-- if fail, rollback and go to start
DROP INDEX foo_idx;
COMMIT;
The idea is that the lock is only acquired if immediately available,
thus not blocking other queries which would otherwise be blocked behind
the DROP INDEX.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2007-05-18 17:39:56 | Re: Async commands (like drop index) |
Previous Message | Neil Conway | 2007-05-18 17:20:41 | Re: Async commands (like drop index) |