Re: How to get the total number of rows returned by query when using a cursor?
В списке pgsql-general по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: How to get the total number of rows returned by query when using a cursor? |
| Дата | |
| Msg-id | 17232.1064330792@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | How to get the total number of rows returned by query when using a cursor? ("Egor Shipovalov" <pgsql_list@eonline.ru>) |
| Ответы |
Re: How to get the total number of rows returned by query when using a cursor?
|
| Список | pgsql-general |
"Egor Shipovalov" <pgsql_list@eonline.ru> writes:
> 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?
Why would you think that? In general Postgres doesn't know the number
of rows until it reaches the end of the query.
> On a side note, why queries using LIMIT are SO terribly slow, compared to
> cursors and sometimes even ones without LIMIT?
Generally they're not particularly slow. Perhaps you should show us the
EXPLAIN ANALYZE results for your problem case.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера