Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id E6BEA650548 for ; Thu, 10 Jul 2008 08:23:17 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 44643-04 for ; Thu, 10 Jul 2008 08:23:10 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.183]) by postgresql.org (Postfix) with ESMTP id A5C5665050F for ; Thu, 10 Jul 2008 08:23:14 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d37so2230009pye.29 for ; Thu, 10 Jul 2008 04:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=JbrvAGP+Y80eWjbrcs3WH9k7yhPmQLSuLSmX6L6Zd4o=; b=Rzvjol+jPbZdWJ34S3xzS0IafJUUx0EYe2U54Y4m5jasDatITQ+ncdCdPDFJUyJJcQ cFMIt1mnnJheIXHC4+Yi1f6LCocWbQ3FRer08ewydyJXPES25hrDddn+5CGUynbWa1+Q 9uBMIv59JfkxaXj5R53D4smr1ck3dPrYarspM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=PZcmjEf1C+vsvdv5bwlqjOB50z7Zz7j7aJW/nnVOX//YVYhnKUZiShscoQDo9JcaIl owaa2cG6hrULweR0Q9JTqAdoY+S+uYi7YEgYin9Ih7X0e36qH/7e50IR7vcW8c6SzavS KE/hyL+5TcNDxSHnw83+Ub5lkqroKo8LRNrYs= Received: by 10.115.33.1 with SMTP id l1mr10573847waj.228.1215688992702; Thu, 10 Jul 2008 04:23:12 -0700 (PDT) Received: by 10.114.130.17 with HTTP; Thu, 10 Jul 2008 04:23:12 -0700 (PDT) Message-ID: Date: Thu, 10 Jul 2008 05:23:12 -0600 From: "Scott Marlowe" To: "Jessica Richard" Subject: Re: how big shmmax is good for Postgres... Cc: pgsql-performance@postgresql.org In-Reply-To: <639285.44246.qm@web56404.mail.re3.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <639285.44246.qm@web56404.mail.re3.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200807/90 X-Sequence-Number: 30690 On Thu, Jul 10, 2008 at 4:53 AM, Jessica Richard wrote: > On a Linux system, if the total memory is 4G and the shmmax is set to 4G, I > know it is bad, but how bad can it be? Just trying to understand the impact > the "shmmax" parameter can have on Postgres and the entire system after > Postgres comes up on this number. There are two settings, shmmax for the OS, and shared_buffers for pgsql. If the OS has a max setting of 4G but pgsql is set to use 512Meg then you'd be safe. Now, assuming that both the OS and pgsql are set to 4G, and you're approaching that level of usage, the OS will start swapping out to make room for the shared memory. The machine will likely be starved of memory, and will go into what's often called a swap storm where it spends all its time swapping stuff in and out and doing little else. > What is the reasonable setting for shmmax on a 4G total machine? Keep in mind that postgresql's shared buffers are just one level of caching / buffering that's going on. The OS caches file access, and sometimes the RAID controller and / or hard drive. Generally the nominal setting is 25% of memory, but that's variable. If the working set of your data will fit in 10% then there's no need for setting shared_memory to 25%...