Re: use cursor in a function

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: use cursor in a function
Дата
Msg-id 3EEF5BCE.1000900@joeconway.com
обсуждение исходный текст
Ответ на Re: use cursor in a function  (Rory Campbell-Lange <rory@campbell-lange.net>)
Ответы Re: use cursor in a function  (Rory Campbell-Lange <rory@campbell-lange.net>)
Список pgsql-novice
Rory Campbell-Lange wrote:
> In a nutshell:
>
> Is there a way of finding out how many rows (ROW_COUNT) are in a cursor
> select? If one can, is there a way of returning a RECORD containing the
> refcursor and the ROW_COUNT?
>

You aren't buying anything by using a cursor. AFAICS the only way that a
cursor would be a benefit, would be if it could persist from page to
page. Then you could grab just the needed tuples without requerying. But
I'm not aware of any way to do that.

So you might as well run a single
  "SELECT count(*) ... WHERE your_criteria_here"
to get the overall count once, and then run your LIMIT/OFFSET query
directly for each page.

Joe


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

Предыдущее
От: Rory Campbell-Lange
Дата:
Сообщение: Re: use cursor in a function
Следующее
От: Lynna Landstreet
Дата:
Сообщение: Re: Multibyte support and accented characters