Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 1748265038D for ; Tue, 2 Sep 2008 15:32:59 -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 50071-01-8 for ; Tue, 2 Sep 2008 15:32:42 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail136085.authsmtp.co.uk (outmail136085.authsmtp.co.uk [62.13.136.85]) by postgresql.org (Postfix) with ESMTP id DA7A6650420 for ; Tue, 2 Sep 2008 14:05:51 -0300 (ADT) Received: from mail-c189.authsmtp.com (mail-c189.authsmtp.com [62.13.128.71]) by punt5.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m82H5mWw038807; Tue, 2 Sep 2008 18:05:48 +0100 (BST) Received: from [192.168.0.2] (85-211-229-97.dyn.gotadsl.co.uk [85.211.229.97]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m82H5lnc031162; Tue, 2 Sep 2008 18:05:47 +0100 (BST) Subject: Re: WIP Join Removal From: Simon Riggs To: Tom Lane Cc: List pgsql-patches In-Reply-To: <15179.1220372890@sss.pgh.pa.us> References: <1220176372.4371.118.camel@ebony.2ndQuadrant> <15179.1220372890@sss.pgh.pa.us> Content-Type: text/plain Date: Tue, 02 Sep 2008 18:13:40 +0100 Message-Id: <1220375620.4371.479.camel@ebony.2ndQuadrant> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: 63669993-7911-11dd-bc7a-001f29070be2 X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadBtFaAdbflxB HGQLW1xEUVp7WWZ/ bwIfZQBDYEtPQQdo WVZARU1QEQdtHhxP WxYcKhwuKVZGe39x Y0QsX3lbXQp8dkB7 S0ddFnABbGZhdWEe BBRFJVBTIR5Kfh4T aFl/U3NfNGdJBC9q VzwLFgwaHRhkHWxq YzlFD1UTRw4xEzs7 WRkGdXVz X-Authentic-SMTP: 61633235383639.kestrel.dmpriest.net.uk:1186/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! 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/27 X-Sequence-Number: 7042 On Tue, 2008-09-02 at 12:28 -0400, Tom Lane wrote: > Simon Riggs writes: > > As discussed on 26 June, "Join Removal/Vertical Partitioning", here's a > > patch to remove joins in certain circumstances. > > Some points not made in the thread so far: Various comments accepted and agreed. > > + * XXX Seems not worth searching partial indexes because those > > + * are only usable with a appropriate restriction, so the > > + * only way they could ever be usable is if there was a > > + * restriction that exactly matched the index predicate, > > + * which is possible but generally unlikely. > > I haven't thought this through entirely, but wouldn't a partial index be > okay if it's marked predOK? You might be right that the case is > unlikely, but if it's only one extra line to support it ... As of now, its it is predOK then that implies there was a qual on the checkrel so can't remove the join. So no need to check. > > + if (removable && > > + joinrel->cheapest_total_path < keeprel->cheapest_total_path) > > This test on cheapest_total_path seems pretty wacko and stuff below it definitely is, from upthread discussion. Hang fire on more comments - its a short patch but needs a few thwacks from the cluestick yet before next review. -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support