From: Kris Jurka <books@ejurka.com>
To: Dave Held <dave.held@arrayservicesgrp.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: JDBC best practice
Date: Mon, 28 Mar 2005 21:52:36 -0500 (EST)
Message-ID: <Pine.BSO.4.56.0503282134260.30526@leary.csoft.net> (raw)
In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F90261848E@asg002.asg.local>
References: <49E94D0CFCD4DB43AFBA928DDD20C8F90261848E@asg002.asg.local>
On Mon, 28 Mar 2005, Dave Held wrote:
> I'm using a Postgres table as the data source for a JTable in a Java
> app. Where rs_ is a RecordSet object. What I'm wondering is whether
> it's better to call absolute() or relative() or next()/previous(). If
> absolute() is the slowest call, then I can cache the last row fetched
> and move relative to that.
>
> My suspicion is that next()/previous() is much faster than absolute()
> when the record to be fetched is very near the last record fetched. I
> haven't actually tried it, but I'd like some insight if others can
> already answer this question based on knowledge of the server side
> and/or the JDBC driver.
There are two types of ResultSets that can be returned by the JDBC driver.
One is backed by a cursor and can only be used for TYPE_FORWARD_ONLY
ResultSets so it is not really applicable to you. The other method
retrieves all results at once and stashes them in a Vector. This makes
next, absolute, and relative positioning all equal cost.
Kris Jurka
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-performance@postgresql.org
Cc: books@ejurka.com, dave.held@arrayservicesgrp.com
Subject: Re: JDBC best practice
In-Reply-To: <Pine.BSO.4.56.0503282134260.30526@leary.csoft.net>
References: <49E94D0CFCD4DB43AFBA928DDD20C8F90261848E@asg002.asg.local> <Pine.BSO.4.56.0503282134260.30526@leary.csoft.net>
* 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