Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 2F7311337B83 for ; Fri, 15 Apr 2011 13:43:17 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 45966-09 for ; Fri, 15 Apr 2011 16:43:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 57420133616B for ; Fri, 15 Apr 2011 13:43:08 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p3FGh1Zf025523; Fri, 15 Apr 2011 12:43:02 -0400 (EDT) To: Mark Kirkwood cc: pgsql-bugs@postgresql.org Subject: Re: Massive memory use for star query In-reply-to: <4DA7CB25.5040102@catalyst.net.nz> References: <4DA7CB25.5040102@catalyst.net.nz> Comments: In-reply-to Mark Kirkwood message dated "Fri, 15 Apr 2011 16:35:49 +1200" Date: Fri, 15 Apr 2011 12:43:01 -0400 Message-ID: <25522.1302885781@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/107 X-Sequence-Number: 30026 Mark Kirkwood writes: > I've recently seen examples of star-like queries using vast amounts of > memory in one of our production systems. Here's a simplified example > using synthetic data (see attached to generate if desired): > SET geqo_threshold = 14; > SET from_collapse_limit = 14; > SET join_collapse_limit = 14; Well, if you're going to do the above, you should be expecting the planner to eat a lot of memory. There is a reason why the default values of those parameters are significantly lower than that ... regards, tom lane