pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Olarte <olarte.andres@gmail.com>
To: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: Advise on mapping JTable to large PostgreSQL table
Date: Tue, 6 Dec 2005 16:33:35 -0600
Message-ID: <3fccaa690512061433m18153115q6ae607cb9febff8c@mail.gmail.com> (raw)
In-Reply-To: <Pine.BSO.4.61.0512061050080.5324@leary.csoft.net>
References: <1133860141.8837.46.camel@Panoramix>
	<Pine.BSO.4.61.0512061050080.5324@leary.csoft.net>

Couldn't you use a single ugly "SELECT *" with a cursor and then fill your
local cache as the client is scrolling through the table?  It will scroll
kind of slow the first time, but then i'll work nice. I'm not very into
Swing, but for that you'd only need the number of rows  with something like
"SELECT count(*)".

On 12/6/05, Kris Jurka <books@ejurka.com> wrote:
>
>
>
> On Tue, 6 Dec 2005, Joost Kraaijeveld wrote:
>
> > I *must* (as in: I have no choice and it can't be solved another way by
> > customer demand) display a large table (> 1.100.000 records) in a JTable
> > ( or something that looks like a JTable for the customer).
> >
> > AS a JTable works with rows, so I have written code that calculates the
> > row of the record in the query and maps any row request to an index in
> > the query.
> >
> > 1. Customer wants the record with 'some text' in column 'a'
> > 2. I calculate the index:
> > select count(*) from table where a < 'some text'
>
> There's got to be a better way of storing this index.  If this is readonly
> data then you could easily number all of these in the database itself.  I
> think the problem may be that you are trying to index all this data as an
> array where you need an absolute offset.  Perhaps a different data
> structure would make a better backing type?
>
> > 4. If not, I get 100 records before and after the requested record,
> > including the record itself and put them in the local cache so that
> > JTable can call AbstratTableModel.getValueAt(row,column) without the
> > need of accessing the database.
>
> How do you determine the records before and after at the moment?
>
> Kris Jurka
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>       choose an index scan if your joining column's datatypes do not
>       match
>

view thread (3+ messages)

Message-ID: <3fccaa690512061433m18153115q6ae607cb9febff8c@mail.gmail.com>
Permalink:  ../3fccaa690512061433m18153115q6ae607cb9febff8c@mail.gmail.com/
Also on:    postgresql.org/message-id/3fccaa690512061433m18153115q6ae607cb9febff8c@mail.gmail.com

 · 

reply

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: olarte.andres@gmail.com
  Subject: Re: Advise on mapping JTable to large PostgreSQL table
  In-Reply-To: <3fccaa690512061433m18153115q6ae607cb9febff8c@mail.gmail.com>
  References: <1133860141.8837.46.camel@Panoramix> <Pine.BSO.4.61.0512061050080.5324@leary.csoft.net> <3fccaa690512061433m18153115q6ae607cb9febff8c@mail.gmail.com>

* 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