Re: Two questions.. shared_buffers and long reader issue

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Two questions.. shared_buffers and long reader issue
Date: 2007-07-11 16:58:26
Message-ID: 20070711165825.GW1241@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Jul 11, 2007 at 05:35:33PM +0200, Patric de Waha wrote:
> Mainly updates on 1 tuple.

Are you vacuuming that table enough?

> 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.

SELECT count(*) is expensive in Postgres. Do you really need it?
Unqualified count() in PostgreSQL is just a bad thing to do, so if
you can work around it (by doing limited subselects, for instance,
where you never scan more than 50 rows, or by keeping counts using
triggers, or various other tricks), it's a good idea.

> Why do long readers influence the rest of the transactions in such a
> heavy way?

It could be because of all those updated tuples not getting vacuumed
(which results in a bad plan). Or it could be that your connection
pool is exhausted: note that when someone hits "reload", that doesn't
mean your old query goes away. It is still crunching through
whatever work it was doing.

> 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.

There has been Much Discussion of this lately on this list. I
suggest you have a look through the recent archives on that topic.

A

--
Andrew Sullivan | ajs(at)crankycanuck(dot)ca
"The year's penultimate month" is not in truth a good way of saying
November.
--H.W. Fowler

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Andrew Sullivan 2007-07-11 17:01:57 Re: TIMING A QUERY ???
Previous Message Tom Lane 2007-07-11 16:57:42 Re: Two questions.. shared_buffers and long reader issue