CURSOR OR OFFSET/LIMIT - Mailing list pgsql-performance

From Kaloyan Iliev
Subject CURSOR OR OFFSET/LIMIT
Date
Msg-id 44352A25.7010107@faith.digsys.bg
Whole thread Raw
Responses Re: CURSOR OR OFFSET/LIMIT
List pgsql-performance
Hi,

I am working on Web Based application using Perl and Apache.
I have to show to the users some query results by pages.
Some time the result can be over 1000 rows (but can be more).
The question is how to make this.

The one way is to use OFFSET and LIMIT. That's OK but every time the
whole query must be parsed and executed.

If I use cursors it's better but my problem is that cursors live only in
the current transaction.
So when the Web Server finish I've lost the transaction and the cursor.

There is some software written from my coleagues that on every server
request open a transaction and cursor. Move to the requested
page and show the result(After that the script finishes, so is the
transaction). So my question is.
Should I rewrte this by using OFFSET/LIMIT or it is better every time to
create the cursor and use it to get the rows.
Is there a way to save the cursor between separe Browser request (and to
give it time to live)? Or After all OFFSET and LIMIT?

Thanks in advance.

Kaloyan Iliev


pgsql-performance by date:

Previous
From: Brian Herlihy
Date:
Subject: Re: Query planner is using wrong index.
Next
From: Vivek Khera
Date:
Subject: Re: Sun Fire T2000 and PostgreSQL 8.1.3