CURSOR OR OFFSET/LIMIT

From: Kaloyan Iliev <news1(at)faith(dot)digsys(dot)bg>
To: pgsql-performance(at)postgresql(dot)org
Subject: CURSOR OR OFFSET/LIMIT
Date: 2006-04-06 14:48:05
Message-ID: 44352A25.7010107@faith.digsys.bg
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Vivek Khera 2006-04-06 15:20:17 Re: Sun Fire T2000 and PostgreSQL 8.1.3
Previous Message Brian Herlihy 2006-04-06 14:01:51 Re: Query planner is using wrong index.