pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John T. Dow <john@johntdow.com>
To: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: refreshRow is slow
Date: Wed, 20 Jan 2010 09:07:58 -0500
Message-ID: <201001201408.o0KE87vp082207@web2.nidhog.com> (raw)
In-Reply-To: <4B511515.6090809@opencloud.com>

Having decided that refreshRow is going to be too slow sometimes (because it does a query for each column to see if it's a primary key), I am for the time being revising my standard application logic to execute the original query again.

A small complication has developed. There is no guarantee that the rows will be returned in the same order, unless the order is explicitly stated in the query. Since my queries are usually user-defined (that is, generated by the application based on user requests in a non-SQL syntax), I'll have to do something like sort on the primary keys in all cases. Not necessarily a bad thing to do I suppose.

But another complication might be confusing to the users. Suppose someone else has added a row. Executing the original query brings up more rows than originally. If the user has been scrolling back and forth through the result set, suddenly a new row will appear. Also possible, someone deletes a row, so it disappears. That is likely to generate a phone call to me ("What happened?").

It sure would be nice if refreshRow was more efficient in learning which are the primary keys.

John




view thread (12+ messages)  latest in thread

Message-ID: <201001201408.o0KE87vp082207@web2.nidhog.com>
Permalink:  ../201001201408.o0KE87vp082207@web2.nidhog.com/
Also on:    postgresql.org/message-id/201001201408.o0KE87vp082207@web2.nidhog.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: john@johntdow.com, oliver@opencloud.com
  Subject: Re: refreshRow is slow
  In-Reply-To: <201001201408.o0KE87vp082207@web2.nidhog.com>
  References: <4B511515.6090809@opencloud.com> <201001201408.o0KE87vp082207@web2.nidhog.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