From: Kaloyan Iliev <news1@faith.digsys.bg>
To: pgsql-performance@postgresql.org
Subject: CURSOR OR OFFSET/LIMIT
Date: Thu, 06 Apr 2006 17:48:05 +0300
Message-ID: <44352A25.7010107@faith.digsys.bg> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: news1@faith.digsys.bg
Subject: Re: CURSOR OR OFFSET/LIMIT
In-Reply-To: <44352A25.7010107@faith.digsys.bg>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox