X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5B5368B9F49 for ; Thu, 3 Feb 2005 20:52:38 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92105-04 for ; Thu, 3 Feb 2005 20:52:26 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id E2E8B8B9E89 for ; Thu, 3 Feb 2005 20:52:26 +0000 (GMT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1CwnxW-00027T-00; Fri, 04 Feb 2005 09:52:14 +1300 Message-ID: <42028EFA.2090407@opencloud.com> Date: Fri, 04 Feb 2005 09:52:10 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bill Schneider Cc: pgsql-jdbc@postgresql.org Subject: Re: optimization for repeated values within JOINs References: <42024C65.50403@vecna.com> In-Reply-To: <42024C65.50403@vecna.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/17 X-Sequence-Number: 12197 Bill Schneider wrote: > Does the PostgreSQL JDBC driver/protocol perform any optimization for > repeated values created by joins? No. The existing protocol is documented at http://www.postgresql.org/docs/8.0/static/protocol.html > Has anyone else thought about this, or does it just not affect > performance enough to matter? pgsql-hackers is probably the place to discuss it. > select a.id, a.longText, b.id > from a join b on b.a_id = a.id > order by a.id; In this case, you could of course turn it into two separate queries when you know the characteristics of the query make that a win. It seems like a lot of work for marginal benefit to try to do some sort of duplicate-elimination automatically in the protocol. -O