[PERFORM] Overusing 1 CPU

2010-06-02 Thread Mozzi
Hallo all

I have a strange problem here.
I have a pgsql database running on Intel hardware here, it has 8 cores
hyperthreaded so you see 16 cpu's.

This box is basically adle @ the moment as it is still in testing yet
top shows high usage on just 1 of the cores.
mpstat gives the below.
As you can see only cpu 1 is verey bussy, the rest are idle.

Thanx

Mozzi

13:02:19 CPU%usr   %nice%sys %iowait%irq   %soft  %steal
%guest   %idle
13:02:21 all4.700.000.411.570.000.000.00
0.00   93.32
13:02:21   00.000.000.000.000.000.000.00
0.00  100.00
13:02:21   1   72.680.005.37   21.460.000.490.00
0.000.00
13:02:21   20.000.000.000.000.000.000.00
0.00  100.00
13:02:21   30.000.000.510.000.000.000.00
0.00   99.49
13:02:21   40.000.000.000.000.000.000.00
0.00  100.00
13:02:21   50.000.000.000.000.000.000.00
0.00  100.00
13:02:21   60.000.000.000.000.000.000.00
0.00  100.00
13:02:21   70.000.000.360.000.000.000.00
0.00   99.64
13:02:21   80.000.000.000.000.000.000.00
0.00  100.00
13:02:21   90.000.000.000.000.000.000.00
0.00  100.00
13:02:21  100.000.000.000.000.000.000.00
0.00  100.00
13:02:21  110.000.000.001.000.000.000.00
0.00   99.00
13:02:21  120.000.000.000.000.000.000.00
0.00  100.00
13:02:21  130.000.000.002.000.000.000.00
0.00   98.00
13:02:21  140.000.000.510.000.000.000.00
0.00   99.49
13:02:21  150.000.000.000.000.000.000.00
0.00  100.00

Average: CPU%usr   %nice%sys %iowait%irq   %soft  %steal
%guest   %idle
Average: all4.660.000.431.460.000.040.00
0.00   93.41
Average:   00.000.000.000.000.000.000.00
0.00  100.00
Average:   1   72.270.005.47   21.580.000.590.00
0.000.10
Average:   20.000.000.000.000.000.000.00
0.00  100.00
Average:   30.100.000.500.000.000.000.00
0.00   99.40
Average:   40.100.000.100.000.000.000.00
0.00   99.80
Average:   50.000.000.000.000.000.000.00
0.00  100.00
Average:   60.000.000.000.000.000.000.00
0.00  100.00
Average:   70.000.000.100.600.000.000.00
0.00   99.30
Average:   80.000.000.000.000.000.000.00
0.00  100.00
Average:   90.000.000.000.000.000.000.00
0.00  100.00
Average:  100.000.000.000.000.000.000.00
0.00  100.00
Average:  110.000.000.000.200.000.000.00
0.00   99.80
Average:  120.000.000.000.000.000.000.00
0.00  100.00
Average:  130.000.000.100.400.000.000.00
0.00   99.50
Average:  140.000.000.500.000.000.000.00
0.00   99.50
Average:  150.000.000.000.000.000.000.00
0.00  100.00



-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


Re: [PERFORM] Overusing 1 CPU

2010-06-02 Thread Matthew Wakeling

On Wed, 2 Jun 2010, Mozzi wrote:

This box is basically adle @ the moment as it is still in testing yet
top shows high usage on just 1 of the cores.


First port of call: What process is using the CPU? Run top on a fairly 
wide terminal and use the c button to show the full command line.


Matthew

--
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.  - Kernighan

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


Re: [PERFORM] Overusing 1 CPU

2010-06-02 Thread Mozzi
Hi

Thanx mate Create Index seems to be the culprit.
Is it normal to just use 1 cpu tho?

Mozzi

On Wed, 2010-06-02 at 12:24 +0100, Matthew Wakeling wrote:
 On Wed, 2 Jun 2010, Mozzi wrote:
  This box is basically adle @ the moment as it is still in testing yet
  top shows high usage on just 1 of the cores.
 
 First port of call: What process is using the CPU? Run top on a fairly 
 wide terminal and use the c button to show the full command line.
 
 Matthew
 



-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


Re: [PERFORM] Overusing 1 CPU

2010-06-02 Thread A. Kretschmer
In response to Mozzi :
 Hi
 
 Thanx mate Create Index seems to be the culprit.
 Is it normal to just use 1 cpu tho?

If you have only one client, yes. If you have more then one active
connections, every connection will use one CPU. In your case: create
index can use only one CPU.


Regards, Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99

-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


Re: [PERFORM] Overusing 1 CPU

2010-06-02 Thread Stephen Frost
Mozzi,

* Mozzi (mozzi.g...@gmail.com) wrote:
 Thanx mate Create Index seems to be the culprit.
 Is it normal to just use 1 cpu tho?

Yes, PG can only use 1 CPU for a given query or connection.  You'll
start to see the other CPUs going when you have more than one connection
to the database.  If you're building alot of indexes then you probably
want to split up the statements into multiple connections and run them
in parallel.

Thanks,

Stephen


signature.asc
Description: Digital signature


Re: [PERFORM] Overusing 1 CPU

2010-06-02 Thread J. Roeleveld
On Wednesday 02 June 2010 13:37:37 Mozzi wrote:
 Hi
 
 Thanx mate Create Index seems to be the culprit.
 Is it normal to just use 1 cpu tho?

If it is a single-threaded process, then yes.
And a Create index on a single table will probably be single-threaded.

If you now start a create index on a different table, a different CPU should 
be used for that.

 
 Mozzi
 
 On Wed, 2010-06-02 at 12:24 +0100, Matthew Wakeling wrote:
  On Wed, 2 Jun 2010, Mozzi wrote:
   This box is basically adle @ the moment as it is still in testing yet
   top shows high usage on just 1 of the cores.
 
  First port of call: What process is using the CPU? Run top on a fairly
  wide terminal and use the c button to show the full command line.
 
  Matthew
 

-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance