Re: How to get the total number of rows returned by query
В списке pgsql-general по дате отправления:
| От | Shridhar Daithankar |
|---|---|
| Тема | Re: How to get the total number of rows returned by query |
| Дата | |
| Msg-id | 3F705FB1.5020804@persistent.co.in обсуждение исходный текст |
| Ответ на | 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
|
| Список | pgsql-general |
Egor Shipovalov wrote: > 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? Using libpq, yes. You can use PQntuples. See http://developer.postgresql.org/docs/postgres/libpq-exec.html#LIBPQ-EXEC-SELECT-INFO Unfortunately this will retrieve the entire resultselt before returning the control. When libpq will have chuncking of data, this will be much more flexible, as you are expecting it now, I guess. Shridhar
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера