X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 37243D1D9E6 for ; Sun, 15 Feb 2004 17:20:45 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 37290-01 for ; Sun, 15 Feb 2004 13:20:40 -0400 (AST) Received: from jefftrout.com (h00a0cc4084e5.ne.client2.attbi.com [24.128.241.68]) by svr1.postgresql.org (Postfix) with SMTP id 672BED1CAF3 for ; Sun, 15 Feb 2004 13:20:39 -0400 (AST) Received: (qmail 35716 invoked from network); 15 Feb 2004 17:20:43 -0000 Received: from unknown (HELO ?192.168.0.6?) (10.10.10.177) by 10.10.10.10 with SMTP; 15 Feb 2004 17:20:43 -0000 In-Reply-To: <402ED348.7000800@geizhals.at> References: <402C213A.4030105@geizhals.at> <200402122228.41680.josh@agliodbs.com> <402ED348.7000800@geizhals.at> Mime-Version: 1.0 (Apple Message framework v612) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <460CEC02-5FDB-11D8-8142-000D9366F0C4@jefftrout.com> Content-Transfer-Encoding: 7bit Cc: pgsql-performance@postgresql.org, josh@agliodbs.com From: Jeff Trout Subject: Re: optimization ideas for frequent, large(ish) updates Date: Sun, 15 Feb 2004 12:20:38 -0500 To: "Marinos J. Yannikos" X-Mailer: Apple Mail (2.612) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/166 X-Sequence-Number: 5690 On Feb 14, 2004, at 9:02 PM, Marinos J. Yannikos wrote: > Josh Berkus wrote: > >> 800MB for sort mem? Are you sure you typed that correctly? You >> must be counting on not having a lot of concurrent queries. It sure >> will speed up index updating, though! > > 800MB is correct, yes... There are usually only 10-30 postgres > processes active (imagine 5-10 people working on the web front-end > while cron jobs access the db occasionally). Very few queries can use > such large amounts of memory for sorting, but they do exist. > Remember that it is going to allocate 800MB per sort. It is not "you can allocate up to 800MB, so if you need 1 meg, use one meg". Some queries may end up having a few sort steps. In terms of sort mem it is best to set a system default to a nice good value for most queries. and then in your reporting queries or other ones set sort_mem for that session (set sort_mem = 800000) then only that session will use the looney sort_mem It would be interesting to know if your machine is swapping. -- Jeff Trout http://www.jefftrout.com/ http://www.stuarthamm.net/