pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bill Schneider <bschneider@vecna.com>
To: pgsql-jdbc@postgresql.org
Subject: optimization for repeated values within JOINs
Date: Thu, 03 Feb 2005 11:08:05 -0500
Message-ID: <42024C65.50403@vecna.com> (raw)

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




view thread (2+ messages)  latest in thread

Message-ID: <42024C65.50403@vecna.com>
Permalink:  ../42024C65.50403@vecna.com/
Also on:    postgresql.org/message-id/42024C65.50403@vecna.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: bschneider@vecna.com
  Subject: Re: optimization for repeated values within JOINs
  In-Reply-To: <42024C65.50403@vecna.com>
  References: <42024C65.50403@vecna.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