Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id EDC4B632A45 for ; Thu, 8 Apr 2010 00:07:29 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 97272-01 for ; Thu, 8 Apr 2010 03:07:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f187.google.com (mail-iw0-f187.google.com [209.85.223.187]) by mail.postgresql.org (Postfix) with ESMTP id 3D5D2634004 for ; Thu, 8 Apr 2010 00:07:19 -0300 (ADT) Received: by iwn17 with SMTP id 17so1037419iwn.19 for ; Wed, 07 Apr 2010 20:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=xcVZ/QNd1SPf6XMqK6Irs2EbcY9V1SfXrYIVU6PfsKw=; b=J15x7i5TDpB/KHg92kSa3ZZaxIjLlF2lkwuj2CKlz1uPZmnDc1DecfEQDVqyyIhQS4 NNb3BvWyS6mRIeoTX/BPKDB2EOakhxIS0Xm/pgUVRKZ1PawMON0FIFFU3AlY8fZ3l8KP 28UP2eb4hZrYmqRu+zHX8qXxA9BKHGGDhnKr0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=f9dmGhBkvkvfsdJuCsxDHXqfxcejUd9LnFEm6gvjiUXirPZfw8O9d6ZzGh2dYyCGSW mHhv7wypfiZdJ+57oUsl4LMpIk+ArZCUUraWy6ne5Q//idv5/nU1SHvzLgHRtE/EsW2h URaTfbTliXnx3If78IzoRXaDbzfMl8dthK1oQ= MIME-Version: 1.0 Received: by 10.231.19.69 with HTTP; Wed, 7 Apr 2010 20:07:18 -0700 (PDT) In-Reply-To: References: <4BBCFB12.1010306@emolecules.com> <4BBD3A17.90209@emolecules.com> Date: Wed, 7 Apr 2010 23:07:18 -0400 Received: by 10.231.60.19 with SMTP id n19mr4451242ibh.79.1270696038600; Wed, 07 Apr 2010 20:07:18 -0700 (PDT) Message-ID: Subject: Re: Occasional giant spikes in CPU load From: Robert Haas To: David Rees Cc: Craig James , pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201004/87 X-Sequence-Number: 38337 On Wed, Apr 7, 2010 at 10:50 PM, David Rees wrote: > On Wed, Apr 7, 2010 at 7:06 PM, Craig James = wrote: >> On 4/7/10 5:47 PM, Robert Haas wrote: >>> On Wed, Apr 7, 2010 at 6:56 PM, David Rees =A0wrote: >>>>> synchronous_commit =3D off >>>> >>>> You are playing with fire here. =A0You should never turn this off unle= ss >>>> you do not care if your data becomes irrecoverably corrupted. >>> >>> That is not correct. =A0Turning off synchronous_commit is sensible if >>> you don't mind losing the last few transactions on a crash. =A0What wil= l >>> corrupt your database is if you turn off fsync. > > Whoops, you're right. > >> A bit off the original topic, but ... >> >> I set it this way because I was advised that with a battery-backed RAID >> controller, this was a safe setting. =A0Is that not the case? > > Robert has it right - with synchronous_commit off, your database will > always be consistent, but you may lose transactions in the event of a > crash. > > Doesn't matter if you have a BBU or not - all the BBU does is give the > controller the ability to acknowledge a write without the data > actually having been written to disk. > > According to the documentation, with synchronous_commit off and a > default wal_writer_delay of 200ms, it's possible to lose up to a > maximum of 600ms of data you thought were written to disk. So, IOW, if you're running a social networking web site and your database is full of status updates sent by teenagers to other teenagers, you might judge that turning off synchronous_commit is a reasonable thing to do, if you need the performance. If you're running a bank and your database is full of information on wire transfers sent and received, not so much. ...Robert