Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id B7B281337C00 for ; Thu, 21 Apr 2011 16:38:09 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 34970-06-2 for ; Thu, 21 Apr 2011 19:38:01 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 9858F1337C06 for ; Thu, 21 Apr 2011 16:37:52 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Thu, 21 Apr 2011 14:37:52 -0500 Message-Id: <4DB04136020000250003CB6A@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Thu, 21 Apr 2011 14:37:42 -0500 From: "Kevin Grittner" To: "pgsql-bugs@postgresql.org" , "Lawrence Cohan" Subject: Re: Postgres not using indexes References: <965AA5440EAC094E9F722519E285ACEDAC5E66A53D@WWCEXCHANGE.web.web.com> <4D9317D3020000250003BF7B@gw.wicourts.gov> <965AA5440EAC094E9F722519E285ACEDAC5E66A556@WWCEXCHANGE.web.web.com> <4D9322E8020000250003BF8C@gw.wicourts.gov> <965AA5440EAC094E9F722519E285ACEDAC5E66A566@WWCEXCHANGE.web.web.com> <4D934830020000250003BFB4@gw.wicourts.gov> <965AA5440EAC094E9F722519E285ACEDB368961C2F@WWCEXCHANGE.web.web.com> In-Reply-To: <965AA5440EAC094E9F722519E285ACEDB368961C2F@WWCEXCHANGE.web.web.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/179 X-Sequence-Number: 30098 Lawrence Cohan wrote: > We managed to put together a new test server running PG 9.0.2 on > 2socketsx6cores = 12CPU with 64 GB RAM against a 3PAR 10TB SAN. We > kept the settings I submitted already (and enclosed below) and > after 12 hours of pounding the box with PGBENCH running 8 scripts > to perform all of INSERT/UPDATE/DELETE/SELECT statements we wanted > we got a pretty good picture of what can do with those settings. > We got a load average of 60 with CPU up and around that 60% mark, > pushing through about 1400 transactions per second for 12 hours. > We made the changes as suggested and listed below but the > throughput dropped from 1400 t/s to 400 t/s and I suspect are the > "stalled" transactions you mentioned about. > > Here's what we changed: > > Current Settings Test Settings > ================================================================ > shared_buffers = 500MB shared_buffers = 8GB > effective_cache_size = 2GB effective_cache_size = 32GB To make sure I understand, are the "Current Settings" the ones which performed better? > Just to be 100% accurate we ask you what do you mean by: > > 1) "Make the background writer more aggressive and/or back > off on shared_memory, so that there isn't such a glut of dirty > pages to Write during a checkpoint." > > By aggressive does he mean changing any of the following? > # - Background Writer - > > #bgwriter_delay = 200ms > #bgwriter_lru_maxpages = 100 > #bgwriter_lru_multiplier = 2.0 We use these overrides: bgwriter_lru_maxpages = 1000 bgwriter_lru_multiplier = 4.0 > Or we should be better of by the checkpoint segment handling - any > of the below: > # - Checkpoints - > > checkpoint_segments = 64 > #checkpoint_timeout = 5min > #checkpoint_completion_target = 0.5 > checkpoint_warning = 60s You might consider increasing checkpoint_timeout if you can tolerate the increased recovery time if there is a crash. You should probably boost checkpoint_completion_target to 0.8 or 0.9. Really, if you don't already have it, you should get a copy of Greg Smith's recent book on performance: http://www.postgresql.org/docs/books/ It gives good descriptions of all of these parameters and advice on incremental tuning to find you best settings. The fact that you listed shared_buffers and effective_cache_size together at least suggests that you don't yet grasp the role of these settings. One affects how much memory PostgreSQL allocates; the other has absolutely nothing to do with that. effective_cache_size affects costs assigned to various plans, thereby affecting plan choice. While a high shared_buffers setting might lead to a glut of writes around commit time, setting effective_cache_size incorrectly might lead to plans which don't read the data efficiently. Seeing what vmstat or iostat say during a slow episode, and seeing whether the episodes correspond to checkpoints, will give you a better indication of where the problem lies. -Kevin