How to get the total number of rows returned by query when using a cursor?

Поиск
Список
Период
Сортировка
От Egor Shipovalov
Тема How to get the total number of rows returned by query when using a cursor?
Дата
Msg-id AKEFIKCGEAEFBICLBFBMOEJBCIAA.pgsql_list@eonline.ru
обсуждение исходный текст
Ответы Re: How to get the total number of rows returned by query  (Shridhar Daithankar <shridhar_daithankar@persistent.co.in>)
Re: How to get the total number of rows returned by query when using a cursor?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I'm implementing paging through search results using cursors. Is there a
better way to know total number of rows under a cursor than running a
separate COUNT(*) query? I think PostgreSQL is bound to know this number
after the first FETCH, isn't it?

On a side note, why queries using LIMIT are SO terribly slow, compared to
cursors and sometimes even ones without LIMIT? Shouldn't LIMIT be internally
implemented using cursor mechanism then?

Best regards,
Egor Shipovalov.


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: after postgres upgrade - ERROR: current transaction
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: table size