Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id A4F6E9FBECF for ; Wed, 11 Jul 2007 12:51:58 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 80593-02 for ; Wed, 11 Jul 2007 12:51:46 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.179]) by postgresql.org (Postfix) with ESMTP id E1D329FBF1E for ; Wed, 11 Jul 2007 12:51:54 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d32so3890712pye for ; Wed, 11 Jul 2007 08:51:52 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=k/84P+rtOKZBrInM//WTgQEboDDHdAz37AoFHL+zObzHKoBta7zImsBLiPnOOFvRazkxTPyFksQ6SkstxQyawIJB782coZsf7NdMnV+wPHVeaG7SZ61v5mS4n+iBUwVS4VLcTZjM9qDz/Qz9gcRuZCgEeLpVllPV49fOmJvaWrg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=i9sLg9CxoL9W5XIIj0BUfMNEHQQQ/hu+F3MZgoob1JfNKJvtZwrFKLDrFlc/ywGIhSpeEirofCFBWfo9Ricr7i2symEwbrvX9WJviVJ0GGOZ53ZAJMp1c50ypbHWReJn59WevbEurEyTGDa+s5UfOPZ7x43wOnesWyPi11UgoS8= Received: by 10.65.151.6 with SMTP id d6mr8604956qbo.1184169111720; Wed, 11 Jul 2007 08:51:51 -0700 (PDT) Received: by 10.64.208.4 with HTTP; Wed, 11 Jul 2007 08:51:51 -0700 (PDT) Message-ID: Date: Wed, 11 Jul 2007 10:51:51 -0500 From: "Bryan Murphy" To: "Patric de Waha" Subject: Re: Two questions.. shared_buffers and long reader issue Cc: pgsql-performance@postgresql.org In-Reply-To: <4694F8C5.2040005@p-dw.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3747_7770093.1184169111678" References: <4694F8C5.2040005@p-dw.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/94 X-Sequence-Number: 25778 ------=_Part_3747_7770093.1184169111678 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline We have a few tables that we need to pull relatively accurate aggregate counts from, and we found the performance of SELECT COUNT(*) to be unacceptable. We solved this by creating triggers on insert and delete to update counts in a secondary table which we join to when we need the count information. This may or may not work in your scenario, but it was a reasonable trade off for us. Bryan On 7/11/07, Patric de Waha wrote: > > Hi, > I've two questions for which I not really found answers in the web. > > Intro: > I've a Website with some traffic. > 2 Million queries a day, during daylight. > Postgres is running on a dedicated server P4 DualCore, 4 Gig Ram. > Mainly updates on 1 tuple. And more or less complex SELECT statements. > I noticed that the overall performance of postgres is decreasing > when one or more long > readers are present. Where a long reader here is already a Select > count(*) from table. > > As postgres gets slower an slower, and users still hammering on the > reload button to get their > page loaded. Postgres begins to reach max connections, and web site > is stuck. > It's not because of a bad schema or bad select statements. As I said, > a select count(*) on big table is already > triggering this behaviour. > > Why do long readers influence the rest of the transactions in such a > heavy way? > Any configuration changes which can help here? > Is it a disc-IO bottleneck thing? > > Second question. What is the right choice for the shared_buffers size? > On a dedicated postgres server with 4 Giga RAM. Is there any rule of > thumb? > Actually I set it to +-256M. > > > thanks for any suggestions. > > Patric > > > My Setup: > > Debian Etch > PSQL: 8.1.4 > > WAL files are located on another disc than the dbase itself. > > max_connections = 190 > shared_buffers = 30000 > temp_buffers = 3000 > work_mem = 4096 > maintenance_work_mem = 16384 > fsync = on > wal_buffers = 16 > effective_cache_size = 5000 > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: You can help support the PostgreSQL project by donating at > > http://www.postgresql.org/about/donate > ------=_Part_3747_7770093.1184169111678 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline We have a few tables that we need to pull relatively accurate aggregate counts from, and we found the performance of SELECT COUNT(*) to be unacceptable.  We solved this by creating triggers on insert and delete to update counts in a secondary table which we join to when we need the count information. 

This may or may not work in your scenario, but it was a reasonable trade off for us.

Bryan

On 7/11/07, Patric de Waha < lists@p-dw.com> wrote:
Hi,
   I've two questions for which I not really found answers in the web.

   Intro:
   I've a Website with some traffic.
   2 Million queries a day, during daylight.
   Postgres is running on a dedicated server  P4 DualCore, 4 Gig Ram.
   Mainly updates on 1 tuple. And more or less complex SELECT statements.
    I noticed that the overall performance of postgres is decreasing
when one or more long
   readers are present. Where a long reader here is already a Select
count(*) from table.

   As postgres gets slower an slower, and users still hammering on the
reload button to get their
   page loaded. Postgres begins to reach max connections, and web site
is stuck.
   It's not because of a bad schema or bad select statements. As I said,
a select count(*) on big table is already
   triggering this behaviour.

   Why do long readers influence the rest of the transactions in such a
heavy way?
   Any configuration changes which can help here?
   Is it a disc-IO bottleneck thing?

   Second question. What is the right choice for the shared_buffers size?
   On a dedicated postgres server with 4 Giga RAM. Is there any rule of
thumb?
   Actually I set it to +-256M.


thanks for any suggestions.

Patric


My Setup:

Debian Etch
PSQL: 8.1.4

WAL files are located on another disc than the dbase itself.

max_connections = 190
shared_buffers = 30000
temp_buffers = 3000
work_mem = 4096
maintenance_work_mem = 16384
fsync = on
wal_buffers = 16
effective_cache_size = 5000


---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate

------=_Part_3747_7770093.1184169111678--