From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Csaba Nagy <nagy(at)ecircle-ag(dot)com> |
Cc: | Marco Colombo <pgsql(at)esiway(dot)net>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Delete/update with limit |
Date: | 2007-07-24 15:29:06 |
Message-ID: | 20070724082230.X42241@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, 24 Jul 2007, Csaba Nagy wrote:
> > How about using the following?
> >
> > delete from <table>
> > where ctid in (select ctid from <table> limit <num>);
> >
>
> I actually checked this out before starting this thread, and the plan
> looked like:
>
> > explain delete from my_table where ctid in (select ctid from my_table
> limit 10);
Unfortunately the stuff that makes a ctid=<value> nice doesn't seem to be
used when you're doing an in. It's possible that a function that does
something like
for rec in select ctid from my_table limit 10 loop
delete from my_table where ctid=rec.ctid;
end loop
might do okay, but I haven't tried it.
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Stark | 2007-07-24 15:30:24 | Re: varchar does not work too well with IS NOT NULL partial indexes. |
Previous Message | Dawid Kuroczko | 2007-07-24 15:19:25 | Re: varchar does not work too well with IS NOT NULL partial indexes. |