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: Fri, 15 Jan 2010 19:13:57 -0500
Message-ID: <201001160014.o0G0EJWO035231@web2.nidhog.com> (raw)
In-Reply-To: <4B50F92D.5020403@opencloud.com>


>> I repeated this with another table. The original query had 792 rows. I went to the last row and made a change. This time there were 408 repetitions. Again, it used the primary key for the $1 parameter shown above.
>> 
>> So why 408 repetitions this time?
>
>408 columns. Is this a very wide SELECT?
>
>I can see that 408 roundtrips would slow things down a lot over a 
>high-latency connection such as over the internet. Perhaps that's the 
>cause of the slowdown you see..


While your email was on its way to me, I was looking at the source for refreshrow and came to the conclusion that it's the number of columns. (Actually, 408 is a bit high, but close. Not important.)

Yes, it is a wide select. Virtually every column in a table is displayable so they all have to be retrieved.

The user who has been complaining (virtually identical code) has a table with only 93 columns, but still that's a lot of round trips.

Certainly that piece of code can be made more efficient. One query ought to be able to return all the primary keys.

I guess something like this won't work, unless "pkey" is reserved: select * from pg_indexes where tablename = 'patinfo' and indexname = 'patinfo_pkey'. That returns indexdev, which can be parsed to get the columns if needed.

John




view thread (12+ messages)  latest in thread

Message-ID: <201001160014.o0G0EJWO035231@web2.nidhog.com>
Permalink:  ../201001160014.o0G0EJWO035231@web2.nidhog.com/
Also on:    postgresql.org/message-id/201001160014.o0G0EJWO035231@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: <201001160014.o0G0EJWO035231@web2.nidhog.com>
  References: <4B50F92D.5020403@opencloud.com> <201001160014.o0G0EJWO035231@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