Re: number of rows in a cursor

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: number of rows in a cursor
Дата
Msg-id 15013.1076427246@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: number of rows in a cursor  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: number of rows in a cursor
Список pgsql-general
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Christoffer Gurell wrote:
>> After declaring a cursor. Is there any way you can check the number of rows
>> that cursor contains ??

> Yes, you can MOVE ALL in the cursor and look at the return status,

Note however that this is *not* a cheap operation.  You might as well
fetch the data, because it's going to cost nearly as much as FETCH.

(Worse, in pre-7.4 versions, MOVE BACKWARDS ALL is also nearly as
expensive as FETCH, so that getting the number of rows and then fetching
the data will cost you close to 3x the runtime of the FETCH alone.)

            regards, tom lane

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

Предыдущее
От: Claudio Cicali
Дата:
Сообщение: Re: I want to use postresql for this app, but...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: newbie pl/pgsql question on trigger function error