| From: | Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> |
|---|---|
| To: | Gregg Jaskiewicz <gryzman(at)gmail(dot)com> |
| Cc: | Misa Simic <misa(dot)simic(at)gmail(dot)com>, Hermann Matthes <hermann(dot)matthes(at)web(dot)de>, pgsql-performance(at)postgresql(dot)org |
| Subject: | Re: Paged Query |
| Date: | 2012-07-09 12:02:38 |
| Message-ID: | 4FFAC85E.4010607@ringerc.id.au |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
On 07/09/2012 07:55 PM, Gregg Jaskiewicz wrote:
> Use cursors.
> By far the most flexible. offset/limit have their down sides.
Do do cursors.
Keeping a cursor open across user think time has resource costs on the
database. It doesn't necessarily require keeping the transaction open
(with hold cursors) but it's going to either require a snapshot to be
retained or the whole query to be executed by the DB and stored somewhere.
Then the user goes away on a week's holiday and leaves their PC at your
"next" button.
All in all, limit/offset have better bounded and defined costs, albeit
not very nice ones.
--
Craig Ringer
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Shaun Thomas | 2012-07-09 13:22:10 | Re: Paged Query |
| Previous Message | Gregg Jaskiewicz | 2012-07-09 11:55:33 | Re: Paged Query |