From: Daniele Bufarini <daniele.bufarini@ie-online.it>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [S] Re: Problems with non scrollable cursors
Date: Mon, 24 Jan 2005 09:53:44 +0100
Message-ID: <41F4B798.60408@ie-online.it> (raw)
In-Reply-To: <Pine.BSO.4.56.0501211452120.8058@leary.csoft.net>
References: <41F12F29.5010602@ie-online.it>
<Pine.BSO.4.56.0501211452120.8058@leary.csoft.net>
Kris Jurka wrote:
>On Fri, 21 Jan 2005, Daniele Bufarini wrote:
>
>
>
>>I'm developing a web application. I haveto know exactly how many pages I
>>have and I have to allow the user to jump to a specific page( this is
>>where I used limit and offset): I know that this solution is VERY slow
>>and I tried to use cursors.... BUT (from PostgreSQL docs):
>>" The Statement must be created with a ResultSet type of
>>ResultSet.TYPE_FORWARD_ONLY. This is the default, so no code will need
>>to be rewritten to take advantage of this, but it also means that you
>>cannot scroll backwards or otherwise jump around in the ResultSet." !!!
>>So I cannot, for example, use the ResultSet.absolute() to jump back in
>>the result set!
>>
>>
>
>You are kind of out of luck. The only way a scrollable cursor will be
>faster than a limit/offset is if you use it multiple times. To use it
>multiple times you need to keep this cursor open across numerous page
>requests. This is a complicated piece of backend state because it may
>take up significant server resources and then there is the business of
>"finding" this cursor again when the user comes back. Are you really
>going to try and keep an open database connection for every user? Not in
>any web app that I know.
>
>Kris Jurka
>
>
Actually using the cursor multiple time is what I was thinking...
In fact, I can keep an open database connection only for large result
set and use a one time connection for all the others.
My problem is that I cannot scroll back using a cursor... I'm wondering
If I have to modify the jdbc driver or the back end or if there are
other solutions, less time consuming...
Daniele Bufarini
--
.-----------------------------------------------------------------.
| Daniele Bufarini Informazioni Editoriali I.E. S.p.A. |
| software architect Via Bergonzoli 1/5 - 20127 Milano (IT)|
| Tel: +3902283151 Fax: +390228315900 |
| http://www.ie-online.it daniele.bufarini@ie-online.it |
| There are only two truly infinite things, the universe and human|
| stupidity; I am unsure of the former. - Albert Einstein |
'-----------------------------------------------------------------'
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: daniele.bufarini@ie-online.it, books@ejurka.com
Subject: Re: [S] Re: Problems with non scrollable cursors
In-Reply-To: <41F4B798.60408@ie-online.it>
References: <41F12F29.5010602@ie-online.it> <Pine.BSO.4.56.0501211452120.8058@leary.csoft.net> <41F4B798.60408@ie-online.it>
* 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