Re: postmaster has high CPU (system) utilization

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Trevor Bylsma <tbylsma(at)atreus-systems(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: postmaster has high CPU (system) utilization
Date: 2003-03-24 01:16:24
Message-ID: 20030324011624.GC24823@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 17, 2003 at 06:10:14PM -0500, Trevor Bylsma wrote:
> What I am doing is, via a perl script, reading about 5000 records out of
> the database and printing them to the screen. This process takes about
> 5 minutes with postmaster hogging the CPU for the duration.
>
> What is odd is that if I then duplicate the same data on another box and
> run the same script there the process takes less then 30 seconds to
> complete. Postmaster will still hog the CPU, but it is 75% user level
> load, rather than system level like it is on the problematic box. (Yes,
> the 2 boxes are of equivalent horsepower and have the same version of
> linux, postgreSQL, and perl installed)
>
> I should also mention that if I run the same query within psql I will
> get all the results in about 4 seconds.

Looks to me that it's not the postmaster doing it, but the process doing the
printing. This is one process where a quality of your video card matter.
Especially the scrolling is heavy on non-accelerated cards. The way to check
this is to redirect the output to a file and see if the difference is still
there.

> Has anybody else run into this problem where postmaster seems to churn
> in system level calls?? Any ideas on how to fix this issue ?

Confirm the problem is where you think it is. One useful trick is to use
strace -c. It will run your program and then give you an idea of which
syscalls the time is spent on.

You can use it on running processes to.
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> IT is not something like pizza that you order in at one o'clock in
> the morning. - John Loebenstein, St George CIO

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Bartley 2003-03-24 02:35:54 4 billion + oids
Previous Message Joe Conway 2003-03-24 00:09:17 Re: Returning an array form a function