X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DD50FD6E83 for ; Thu, 22 Sep 2005 20:50:16 -0300 (ADT) 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 54133-08 for ; Thu, 22 Sep 2005 23:50:08 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id F3020D7933 for ; Thu, 22 Sep 2005 20:50:09 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j8MNo2Lk018134; Thu, 22 Sep 2005 19:50:02 -0400 (EDT) To: Michael Fuhr Cc: Jean-Pierre Pelletier , Josh Berkus , pgsql-performance@postgresql.org, John Arbash Meinel Subject: Re: Queries 15 times slower on 8.1 beta 2 than on 8.0 In-reply-to: <20050922231746.GA25296@winnie.fuhr.org> References: <433326A6.8010708@arbash-meinel.com> <200509221519.05555.josh@agliodbs.com> <20050922225432.GA25103@winnie.fuhr.org> <021501c5bfca$6fe82130$6501a8c0@JP> <20050922231746.GA25296@winnie.fuhr.org> Comments: In-reply-to Michael Fuhr message dated "Thu, 22 Sep 2005 17:17:46 -0600" Date: Thu, 22 Sep 2005 19:50:02 -0400 Message-ID: <18133.1127433002@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200509/268 X-Sequence-Number: 14576 Michael Fuhr writes: > Tom Lane says he's found the problem; I expect he'll be committing > a fix shortly. The attached patch allows it to generate the expected plan, at least in the test case I tried. regards, tom lane *** src/backend/optimizer/path/indxpath.c.orig Sun Aug 28 18:47:20 2005 --- src/backend/optimizer/path/indxpath.c Thu Sep 22 19:17:41 2005 *************** *** 955,969 **** /* * Examine each joinclause in the joininfo list to see if it matches any * key of any index. If so, add the clause's other rels to the result. - * (Note: we consider only actual participants, not extraneous rels - * possibly mentioned in required_relids.) */ foreach(l, rel->joininfo) { RestrictInfo *joininfo = (RestrictInfo *) lfirst(l); Relids other_rels; ! other_rels = bms_difference(joininfo->clause_relids, rel->relids); if (matches_any_index(joininfo, rel, other_rels)) outer_relids = bms_join(outer_relids, other_rels); else --- 955,967 ---- /* * Examine each joinclause in the joininfo list to see if it matches any * key of any index. If so, add the clause's other rels to the result. */ foreach(l, rel->joininfo) { RestrictInfo *joininfo = (RestrictInfo *) lfirst(l); Relids other_rels; ! other_rels = bms_difference(joininfo->required_relids, rel->relids); if (matches_any_index(joininfo, rel, other_rels)) outer_relids = bms_join(outer_relids, other_rels); else