optimization for repeated values within JOINs - Mailing list pgsql-jdbc

From Bill Schneider
Subject optimization for repeated values within JOINs
Date
Msg-id 42024C65.50403@vecna.com
Whole thread Raw
Responses Re: optimization for repeated values within JOINs
List 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@vecna.com
t: 301-864-7253 x1140
f: 301-699-3180


pgsql-jdbc by date:

Previous
From: Kovács Péter
Date:
Subject: Re: Primary schema name prepended to database objects
Next
From: Oliver Jowett
Date:
Subject: Re: optimization for repeated values within JOINs