Re: Delete/update with limit

Поиск
Список
Период
Сортировка
От Csaba Nagy
Тема Re: Delete/update with limit
Дата
Msg-id 1185294357.8615.37.camel@coppola.muc.ecircle.de
обсуждение исходный текст
Ответ на Re: Delete/update with limit  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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.



В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: varchar does not work too well with IS NOT NULL partial indexes.
Следующее
От: Viatcheslav Kalinin
Дата:
Сообщение: Pattern matching with index