How to get the total number of rows with a query "limit" ?
В списке pgsql-general по дате отправления:
| От | proghome@silesky.com (krystoffff) |
|---|---|
| Тема | How to get the total number of rows with a query "limit" ? |
| Дата | |
| Msg-id | 85898f7e.0308130543.3568ea8b@posting.google.com обсуждение исходный текст |
| Ответы |
Re: How to get the total number of rows with a query
|
| Список | pgsql-general |
Hi I would like to paginate the results of a query on several pages. So I use a query with a limit X offset Y to display X results on a page, ok. But for the first page, I need to run the same query with a count(*) to know how many pages I will get (number total of rows/ X). The problem is my query is very slow (maybe 5s) because there is much worch to do, and on the first page, I need to run this query twice (not exactly, but ...) so the page is very very slow to load. My question is : is there a function to get the total number of rows even on a query with "limit" ? Or what could I do else ? Has anybody an idea ? Thanks for the help Krystoffff
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера