Thread: Performance issues with postgresql-8.4.0

Performance issues with postgresql-8.4.0

From
"Sachin Kumar"
Date:

Hi,

 

We are using postgresql-8.4.0 on 64-bit Linux machine (open-SUSE 11.x). It’s a master/slave deployment & slony-2.0.4.rc2 is used for DB replication on the slave box.

 

At times we have observed that postgres stops responding for several minutes, even couldn’t fetch the number of entries in a particular table. One such instance happens when we execute the following steps:

-         Add few lakh entries (~20) to table X on the master DB.

-         After addition, slony starts replication on the slave DB. It takes several minutes (~25 mins) for replication to finish.

-         During this time (while replication is in progress), sometimes postgres stops responding, i.e. we couldn’t even fetch the number of entries in any table (X, Y, etc).

 

Can you please let us know what could the reason for such a behavior and how it can be fixed/improved.

 

Regards,

Sachin

 

Re: Performance issues with postgresql-8.4.0

From
Craig Ringer
Date:
On 29/06/10 15:01, Sachin Kumar wrote:

> At times we have observed that postgres stops responding for several
> minutes, even couldn't fetch the number of entries in a particular
> table.

Quick guess: checkpoints. Enable checkpoint logging, follow the logs,
see if there's any correspondance.

In general, looking at the logs might help you identify the issue.

 One such instance happens when we execute the following steps:
>
> -         Add few lakh entries (~20) to table X on the master DB.
>
> -         After addition, slony starts replication on the slave DB. It
> takes several minutes (~25 mins) for replication to finish.
>
> -         During this time (while replication is in progress), sometimes
> postgres stops responding, i.e. we couldn't even fetch the number of
> entries in any table (X, Y, etc).

Fetching the number of entries in a table - using count(...) - is
actually a rather expensive operation, and a poor choice if you just
want to see if the server is responsive.

  SELECT id FROM tablename LIMIT 1;

where "id" is the primary key of the table would be a better option.

--
Craig Ringer