Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id B8D1565016B for ; Tue, 2 Sep 2008 10:42:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 28896-04-3 for ; Tue, 2 Sep 2008 10:42:37 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.188]) by postgresql.org (Postfix) with ESMTP id 304AD65021C for ; Tue, 2 Sep 2008 10:42:32 -0300 (ADT) Received: by fk-out-0910.google.com with SMTP id e30so1856659fke.3 for ; Tue, 02 Sep 2008 06:42:30 -0700 (PDT) Received: by 10.180.236.14 with SMTP id j14mr5788677bkh.36.1220362949961; Tue, 02 Sep 2008 06:42:29 -0700 (PDT) Received: from ?80.222.42.69? ( [80.222.42.69]) by mx.google.com with ESMTPS id f4sm40781515nfh.27.2008.09.02.06.42.28 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 02 Sep 2008 06:42:29 -0700 (PDT) Message-ID: <48BD42C1.6010201@enterprisedb.com> Date: Tue, 02 Sep 2008 16:42:25 +0300 Organization: EnterpriseDB User-Agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509) MIME-Version: 1.0 To: Gregory Stark CC: Simon Riggs , List pgsql-patches Subject: Re: WIP Join Removal References: <1220176372.4371.118.camel@ebony.2ndQuadrant> <48BC4127.30706@enterprisedb.com> <1220348487.4371.307.camel@ebony.2ndQuadrant> <48BD1374.4030504@enterprisedb.com> <1220352112.4371.349.camel@ebony.2ndQuadrant> <48BD1852.1070904@enterprisedb.com> <1220352898.4371.355.camel@ebony.2ndQuadrant> <87od36u7st.fsf@oxford.xeocode.com> In-Reply-To: <87od36u7st.fsf@oxford.xeocode.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit From: Heikki Linnakangas X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200809/18 X-Sequence-Number: 7033 Gregory Stark wrote: > I wonder if it would be more worthwhile to remove them and have a subsequent > phase where we look for possible joins to *add*. So even if the user writes > "select * from invoices where customer_id=?" the planner might be able to > discover that it can find those records quicker by scanning customer, finding > the matching and then using an index to look them up > in invoices. Yeah, that would be cool. The question is whether it's worth the additional overhead in planner, compared to the gain in the rare case that it's applicable. That's always the thing with planner tricks like this. I think we'll eventually need some sort of tuning knob to control how hard the planner tries to apply different optimizations like that. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com