Re: Async commands (like drop index)

From: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, "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 19:20:24
Message-ID: 20070518192024.GB14548@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)decibel(dot)org
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ron Mayer 2007-05-18 19:38:09 Idea that might inspire more patch reviewing.
Previous Message Neil Conway 2007-05-18 17:39:56 Re: Async commands (like drop index)