Re: DELETE with LIMIT (or my first hack) - Mailing list pgsql-hackers

From Robert Haas
Subject Re: DELETE with LIMIT (or my first hack)
Date
Msg-id AANLkTimc6qdcD9c+MJS+85dpbY6ovvbmQVrZRtkbq5ey@mail.gmail.com
Whole thread Raw
In response to Re: DELETE with LIMIT (or my first hack)  (Csaba Nagy <ncslists@googlemail.com>)
Responses Re: DELETE with LIMIT (or my first hack)
List pgsql-hackers
On Tue, Nov 30, 2010 at 4:25 AM, Csaba Nagy <ncslists@googlemail.com> wrote:
> The workaround recommended some time ago by Tom is:
>
> DELETE FROM residents_of_athens WHERE ctid = any(array(SELECT ctid FROM
> residents_of_athens ORDER BY ostracism_votes DESC LIMIT 1));
>
> It is about as efficient as the requested feature would be, just uglier
> to write down. I use it all the time when batch-deleting something large
> (to avoid long running transactions and to not crash slony). It also
> helps to vacuum frequently if you do that on large amount of data...

That's a very elegant hack, but not exactly obvious to a novice user
or, say, me.  So I think it'd be nicer to have the obvious syntax
work.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Tab completion for view triggers in psql
Next
From: Robert Haas
Date:
Subject: Re: GiST insert algorithm rewrite