X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 001AE9DCA94 for ; Tue, 20 Dec 2005 15:47:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45834-09 for ; Tue, 20 Dec 2005 15:47:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (unknown [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id D77CE9DCA85 for ; Tue, 20 Dec 2005 15:47:10 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 774C63982A; Tue, 20 Dec 2005 13:47:10 -0600 (CST) Date: Tue, 20 Dec 2005 13:47:10 -0600 From: "Jim C. Nasby" To: Greg Stark Cc: Cristian Prieto , pgsql-performance@postgresql.org Subject: Re: Any way to optimize GROUP BY queries? Message-ID: <20051220194710.GJ28771@pervasive.com> References: <00d701c604c1$e6945d80$6500a8c0@gt.ClickDiario.local> <87wti0ak60.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wti0ak60.fsf@stark.xeocode.com> X-Operating-System: FreeBSD 6.0-RELEASE amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.04 required=5 tests=[AWL=0.040] X-Spam-Score: 0.04 X-Spam-Level: X-Archive-Number: 200512/508 X-Sequence-Number: 16329 On Mon, Dec 19, 2005 at 03:47:35PM -0500, Greg Stark wrote: > Increase your work_mem (or sort_mem in older postgres versions), you can do > this for the server as a whole or just for this one session and set it back > after this one query. You can increase it up until it starts causing swapping > at which point it would be counter productive. Just remember that work_memory is per-operation, so it's easy to push the box into swapping if the workload increases. You didn't say how much memory you have, but I'd be careful if work_memory * max_connections gets very much larger than your total memory. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461