postmaster has high CPU (system) utilization - Mailing list pgsql-general

From Trevor Bylsma
Subject postmaster has high CPU (system) utilization
Date
Msg-id 1047942615.17591.416.camel@trevor
Whole thread Raw
Responses Re: postmaster has high CPU (system) utilization  (Martijn van Oosterhout <kleptog@svana.org>)
Re: postmaster has high CPU (system) utilization  ("scott.marlowe" <scott.marlowe@ihs.com>)
Re: postmaster has high CPU (system) utilization  (Manfred Koizar <mkoi-pg@aon.at>)
List pgsql-general
I'm using postgreSQL and perl DBI and have come across this issue:

postmaster will use most of the CPU for an extended amount of time (which isn't odd) but 75% of that is system level (which seems odd)...

<-- snippit from top -->
  4:45pm  up 17 days, 22:22,  5 users,  load average: 0.71, 0.29, 0.19
84 processes: 69 sleeping, 15 running, 0 zombie, 0 stopped
CPU states: 25.6% user, 74.3% system,  0.0% nice,  0.0% idle
Mem:   257136K av,  241656K used,   15480K free,  147956K shrd,   55740K buff
Swap:  514072K av,     136K used,  513936K free                   42724K cached

  PID   USER     PRI  NI  SIZE  RSS SHARE STAT  LIB %CPU %MEM   TIME COMMAND
19906 postgres  11   0  4552 4552  3792      R       0    87.3      1.7       0:55 postmaster
<-- end of snippit -->

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.

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

Thanks in advance,
Trevor.

pgsql-general by date:

Previous
From: "Yuan Lin"
Date:
Subject: A question about "table function"
Next
From: u15074
Date:
Subject: Is there a nowait option for 'lock table'?