Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id A303F1337B9E for ; Fri, 12 Nov 2010 12:13:21 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 99933-09 for ; Fri, 12 Nov 2010 16:13:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gw0-f46.google.com (mail-gw0-f46.google.com [74.125.83.46]) by mail.postgresql.org (Postfix) with ESMTP id F20AB1337BC2 for ; Fri, 12 Nov 2010 12:13:12 -0400 (AST) Received: by gwb20 with SMTP id 20so599654gwb.19 for ; Fri, 12 Nov 2010 08:13:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=+dPL/JfeiNzPH9Sghth9tEbiTwIG/IgJ7vg+DUwJHV0=; b=KHCCaL2fPXu6NgGLdLS2crNlGR/DAgmHzlqjwbdrn742Aa6oB+vjP7qwfne0l6teDs VDtonh/92+fxA3hL3iHK5VsWDNJXkomNvkaK9TS7c0K/Mgz2CDc1NmXzh06VCWw58Tox UcQOE6VHRqXHh1gQ8bNMGJpLQPGt2U2OLQyAI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=Xl4iVNCrImJVS2AOkrOktc5WW17ivejqn0WQNbf7mAc29HAT/w4AFzL1xHdtEhDQKl qC1MfxiytXJ7F6rtxBqdu7Zw3yZWHTJ6GuOfEkyyMPk592avDYEuBj2Eouatr+xxfpWR VCJ0irJ423grxhoiknkwqeGGC4SEPAj71anj8= Received: by 10.42.229.3 with SMTP id jg3mr2921987icb.19.1289578386472; Fri, 12 Nov 2010 08:13:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.42.179.6 with HTTP; Fri, 12 Nov 2010 08:12:26 -0800 (PST) In-Reply-To: References: From: Pavel Stehule Date: Fri, 12 Nov 2010 17:12:26 +0100 Message-ID: Subject: Re: postmaster consuming /lots/ of memory with hash aggregate. why? To: Jon Nelson Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=UTF-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201011/195 X-Sequence-Number: 41219 2010/11/12 Jon Nelson : > On Thu, Nov 11, 2010 at 10:38 PM, Pavel Stehule wrote: >> 2010/11/12 Jon Nelson : >>> On Thu, Nov 11, 2010 at 10:26 PM, Pavel Stehule wrote: >>>> Hello >>>> >>>> look on EXPLAIN ANALYZE command. Probably your statistic are out, and >>>> then planner can be confused. EXPLAIN ANALYZE statement show it. >>> >>> As I noted earlier, I did set statistics to 1000 an re-ran vacuum >>> analyze and the plan did not change. >> >> this change can do nothing. this is default in config. did you use >> ALTER TABLE ALTER COLUMN SET STATISTIC = ... ? and ANALYZE > > No. To be clear: are you saying that changing the value for > default_statistics_target, restarting postgresql, and re-running > VACUUM ANALYZE does *not* change the statistics for columns > created/populated *prior* to the sequence of operations, and that one > /must/ use ALTER TABLE ALTER COLUMN SET STATISTICS ... and re-ANALYZE? > yes. but I was wrong. Documentation is correct. Problem is elsewhere. > That does not jive with the documentation, which appears to suggest > that setting a new default_statistics_target, restarting postgresql, > and then re-ANALYZE'ing a table should be sufficient (provided the > columns have not had a statistics target explicitly set). > >>> What other diagnostics can I provide? This still doesn't answer the >>> 40000 row question, though. It seems absurd to me that the planner >>> would give up and just use 40000 rows (0.02 percent of the actual >>> result). >>> >> >> there can be some not well supported operation, then planner use a >> some % from rows without statistic based estimation > > The strange thing is that the value 40000 keeps popping up in totally > diffferent contexts, with different tables, databases, etc... I tried > digging through the code and the only thing I found was that numGroups > was being set to 40000 but I couldn't see where. > if I remember well, you can set a number of group by ALTER TABLE ALTER COLUMN SET n_distinct = .. maybe you use it. Regards Pavel Stehule http://www.postgresql.org/docs/9.0/interactive/sql-altertable.html > -- > Jon > > -- > Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-performance >