optimization for repeated values within JOINs

From: Bill Schneider <bschneider(at)vecna(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: optimization for repeated values within JOINs
Date: 2005-02-03 16:08:05
Message-ID: 42024C65.50403@vecna.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

Does the PostgreSQL JDBC driver/protocol perform any optimization for
repeated values created by joins? For example, let's say you have a
query like

select a.id, a.longText, b.id
from a join b on b.a_id = a.id
order by a.id;

In the returned result set, the a.longText value will be duplicated for
every b that matches the row in a.

Is it possible for the driver to do some kind of optimization to prevent
pushing the longText value over the network redundantly when it just
repeats the value from the last row in the result set?

Likewise, since String is immutable, could the JDBC driver use the same
String instance rather than instantiating a new String when the value
returned exactly matches the last row?

I guess this isn't about the JDBC driver so much as the underlying
protocol--you'd need some code to indicate "same as last row" for any
given column.

Has anyone else thought about this, or does it just not affect
performance enough to matter?

-- Bill
--
Bill Schneider
Chief Architect

Vecna Technologies
5004 Lehigh Rd., Suite B
College Park, MD 20740
bschneider(at)vecna(dot)com
t: 301-864-7253 x1140
f: 301-699-3180

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-02-03 20:52:10 Re: optimization for repeated values within JOINs
Previous Message Rainer Frey 2005-02-03 15:11:26 BUG #1459: Connection hangs when other connection is not committed