Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 9541C475988 for ; Thu, 25 Apr 2002 15:35:05 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id DCC4DD605; Thu, 25 Apr 2002 12:35:00 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id C65AB5C01; Thu, 25 Apr 2002 12:35:00 -0700 (PDT) Date: Thu, 25 Apr 2002 12:35:00 -0700 (PDT) From: Stephan Szabo To: S Grannis Cc: Subject: Re: Performance Issues with count() In-Reply-To: <20020425185441.10228.qmail@email.com> Message-ID: <20020425123052.N71187-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200204/1093 X-Sequence-Number: 23807 On Thu, 25 Apr 2002, S Grannis wrote: > Others have suggested the "fix" is in the future. > > Stephan Szabo wrote: > "I didn't see anything about your settings in postgresql.conf, > but increasing the sort_mem parameter may help that really > expensive sort step. I think the desired fix for this would > probably be the TODO entry on hash based aggregates but that's > still in the future..." > > The "non-default" postgresql.conf settings are as follows: > > shared_buffers = 240000 # uses ~2GB of shared mem > sort_mem = 512 It might be interesting to try with sort_mem set up an order of magnitude to see if that helps at all. I doubt it'll be enough, but it's probably worth trying. > I think our work-around for now will be to SELECT the column we wish > to analyze into a flat file and then run a Perl script to do the > actual counting. Another option would be a C function that does runs a query via SPI and does the hashing count and sticks it in a temporary table but that may be a bit excessive.