CURSOR OR OFFSET/LIMIT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux