Portal question
| От | Christopher Kings-Lynne |
|---|---|
| Тема | Portal question |
| Дата | |
| Msg-id | ECEHIKNFIMMECLEBJFIGGEGKCBAA.chriskl@familyhealth.com.au обсуждение исходный текст |
| Список | pgsql-hackers |
Hi all, This is the situation: You are doing a big query, but you want the results on the web page to be paginated. ie. The user can click page 1, 2, etc. So, you need know how many rows total would be returned, but you also only need a small fraction of them. What is an efficient way of doing this? It seems to me that using a CURSOR would be advantageous, however once a CURSOR is opened, how do you get the full row count? ie. Can you do this:? 1. Declare a cursor 2. Find the total number of rows returned 3. Fetch the subset of the rows that are required 4. Construct a pagination based on the info from 2 and 3. If this can't be done - how do you do it? Is the only way to repeat the whole query twice, the first time doing a count(*) instead of the select variables? Thanks, Chris
В списке pgsql-hackers по дате отправления: