X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9D5265E46D2 for ; Tue, 24 Aug 2004 12:23:29 -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 24428-05 for ; Tue, 24 Aug 2004 15:23:34 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7249E5E46CF for ; Tue, 24 Aug 2004 12:23:24 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i7OFNVPf004016; Tue, 24 Aug 2004 11:23:31 -0400 (EDT) To: Stef Cc: pgsql-performance@postgresql.org Subject: Re: Query kills machine. In-reply-to: <20040824153014.2a11d228@svb.ucs.co.za> References: <20040824103240.4d909777@svb.ucs.co.za> <412B05A2.8070301@familyhealth.com.au> <20040824153014.2a11d228@svb.ucs.co.za> Comments: In-reply-to Stef message dated "Tue, 24 Aug 2004 15:30:14 +0200" Date: Tue, 24 Aug 2004 11:23:31 -0400 Message-ID: <4015.1093361011@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/325 X-Sequence-Number: 7961 Stef writes: > Reducing sort_mem to 4096 seems to make it run in a reasonable time > again. Any idea why? The database does a whole lot of huge sorts > every day, so I thought upping this parameter would help. Not if you haven't got the RAM to support it :-( Another thing you might look at is ANALYZEing the tables again after you've loaded all the new data. The row-count estimates seem way off in these plans. You might need to increase the statistics target, too, to get better plans. regards, tom lane