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


--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Reply via email to