From: | Csaba Nagy <nagy(at)ecircle-ag(dot)com> |
---|---|
To: | Postgres general mailing list <pgsql-general(at)postgresql(dot)org> |
Cc: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, Marco Colombo <pgsql(at)esiway(dot)net> |
Subject: | Re: Delete/update with limit |
Date: | 2007-07-24 16:25:57 |
Message-ID: | 1185294357.8615.37.camel@coppola.muc.ecircle.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, 2007-07-24 at 18:19, Tom Lane wrote:
> [ thinks for a bit ... ] Actually, you can do it as of 8.2 or so,
> by abusing the ScalarArrayOp stuff: turn the subquery into an array.
> An example in the regression database:
>
> regression=# explain update tenk1 set ten=ten+1
> regression-# where ctid = any (array(select ctid from tenk1 limit 10));
> QUERY PLAN
> -------------------------------------------------------------------------
> Tid Scan on tenk1 (cost=0.46..40.71 rows=10 width=250)
> TID Cond: (ctid = ANY ($0))
> InitPlan
> -> Limit (cost=0.00..0.46 rows=10 width=6)
> -> Seq Scan on tenk1 (cost=0.00..458.00 rows=10000 width=6)
> (5 rows)
>
> It even seems to get the cost estimate right...
Cool, I will use this then (we do have the relevant DB on 8.2). It would
still be nice to have it work directly...
Thanks,
Csaba.
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Stark | 2007-07-24 17:00:22 | Re: Delete/update with limit |
Previous Message | Tom Lane | 2007-07-24 16:21:09 | Re: varchar does not work too well with IS NOT NULL partial indexes. |