pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bryan Murphy <bryan.murphy@gmail.com>
To: Patric de Waha <lists@p-dw.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Two questions.. shared_buffers and long reader issue
Date: Wed, 11 Jul 2007 10:51:51 -0500
Message-ID: <bd8531800707110851u19d2437dj7c085d60d4d8e4b9@mail.gmail.com> (raw)
In-Reply-To: <4694F8C5.2040005@p-dw.com>
References: <4694F8C5.2040005@p-dw.com>

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
>

view thread (5+ messages)  latest in thread

Message-ID: <bd8531800707110851u19d2437dj7c085d60d4d8e4b9@mail.gmail.com>
Permalink:  ../bd8531800707110851u19d2437dj7c085d60d4d8e4b9@mail.gmail.com/
Also on:    postgresql.org/message-id/bd8531800707110851u19d2437dj7c085d60d4d8e4b9@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: bryan.murphy@gmail.com, lists@p-dw.com
  Subject: Re: Two questions.. shared_buffers and long reader issue
  In-Reply-To: <bd8531800707110851u19d2437dj7c085d60d4d8e4b9@mail.gmail.com>
  References: <4694F8C5.2040005@p-dw.com> <bd8531800707110851u19d2437dj7c085d60d4d8e4b9@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox