View Single Post

   
  #9 (permalink)  
Old 04-12-2008, 09:47 AM
Jim C. Nasby
 
Posts: n/a
Default Re: Async commands (like drop index)

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)

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Reply With Quote