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 4F6118B9E7F for ; Thu, 3 Feb 2005 16:10:06 +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 43857-10 for ; Thu, 3 Feb 2005 16:10:02 +0000 (GMT) Received: from owlery.vecna.com (owlery.vecna.com [207.188.238.194]) by svr1.postgresql.org (Postfix) with ESMTP id 617F78B9E02 for ; Thu, 3 Feb 2005 16:10:00 +0000 (GMT) Received: from vecna.com (george.mco.vecna.com [192.168.3.12]) (authenticated bits=0) by owlery.vecna.com (8.12.8/8.12.8) with ESMTP id j13G9w1g010685 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 3 Feb 2005 11:09:59 -0500 Message-ID: <42024C65.50403@vecna.com> Date: Thu, 03 Feb 2005 11:08:05 -0500 From: Bill Schneider Organization: Vecna Technologies, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: optimization for repeated values within JOINs Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/16 X-Sequence-Number: 12196 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