Re: delete to slow

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: delete to slow
Дата
Msg-id 23990.1114300420@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: delete to slow  ("Spiegelberg, Greg" <gspiegelberg@cranel.com>)
Список pgsql-admin
"Spiegelberg, Greg" <gspiegelberg@cranel.com> writes:
> Would it be possible to perform a DELETE FROM table WHERE CURRENT OF mycursor?
> Is this implemented in Postgres?  I'm not seeing in in the manual for 7.4 or 8.

It is (or at least ought to be) on the TODO list, but it's not done yet
and I don't think anyone's working on it.

A reasonably efficient way to fake it is to include CTID in the cursor
readout and issue a delete-by-ctid instead.

    DECLARE c CURSOR FOR SELECT ctid, ... FROM mytable WHERE ...;
    FETCH FROM c;
    DELETE FROM mytable WHERE ctid = 'whatever';

This is more or less what would have to happen behind the scenes for
WHERE CURRENT OF to be implemented.

            regards, tom lane

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Product Suggestions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: FW: PostgreSQL (real and effective user ids must match) error