From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Csaba Nagy <ncslists(at)googlemail(dot)com> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>, Daniel Loureiro <loureirorg(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: DELETE with LIMIT (or my first hack) |
Date: | 2010-11-30 14:19:26 |
Message-ID: | AANLkTimc6qdcD9c+MJS+85dpbY6ovvbmQVrZRtkbq5ey@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Nov 30, 2010 at 4:25 AM, Csaba Nagy <ncslists(at)googlemail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2010-11-30 14:23:33 | Re: GiST insert algorithm rewrite |
Previous Message | David Fetter | 2010-11-30 14:15:08 | Re: Tab completion for view triggers in psql |