Re: Async commands (like drop index) - Mailing list pgsql-hackers

From Jim C. Nasby
Subject Re: Async commands (like drop index)
Date
Msg-id 20070518192024.GB14548@nasby.net
Whole thread Raw
In response to Re: Async commands (like drop index)  (Neil Conway <neilc@samurai.com>)
List pgsql-hackers
On Fri, May 18, 2007 at 01:39:56PM -0400, Neil Conway wrote:
> On Fri, 2007-18-05 at 13:29 -0400, Alvaro Herrera wrote:
> > I think what Joshua really wants is an equivalent of this
> 
> That's not what his original email asked for, at any rate.
> 
> > 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.
> 
> ISTM this can easily be implemented with statement_timeout (which is
> more general to boot).

Well, with statement_timeout, and writing a function...

This functionality would actually be useful, but I'm not sure if it's
worth including in core. It would be really nice to have an example of
how to do this in a PostgreSQL Cookbook somewhere though.
-- 
Jim Nasby                                      decibel@decibel.org
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)


pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: Re: Async commands (like drop index)
Next
From: Ron Mayer
Date:
Subject: Idea that might inspire more patch reviewing.