CURSOR OR OFFSET/LIMIT

Поиск
Список
Период
Сортировка
От Kaloyan Iliev
Тема CURSOR OR OFFSET/LIMIT
Дата
Msg-id 44352A25.7010107@faith.digsys.bg
обсуждение исходный текст
Ответы Re: CURSOR OR OFFSET/LIMIT  (John DeSoi <desoi@pgedit.com>)
Список 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 по дате отправления:

Предыдущее
От: Brian Herlihy
Дата:
Сообщение: Re: Query planner is using wrong index.
Следующее
От: Vivek Khera
Дата:
Сообщение: Re: Sun Fire T2000 and PostgreSQL 8.1.3