pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jean-David Beyer <jeandavid8@verizon.net>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Utilizing multiple cores for one query
Date: Sat, 01 Dec 2007 12:03:59 -0500
Message-ID: <475193FF.1080803@verizon.net> (raw)
In-Reply-To: <BAY124-W118FBDAAF28CB55D8A705AF5720@phx.gbl>
References: <BAY124-W312F15BBE3D85AE1D472F8F5720@phx.gbl>
	<36e682920712010531k47871797ge19ceaddad9a7ff6@mail.gmail.com>
	<BAY124-W118FBDAAF28CB55D8A705AF5720@phx.gbl>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

henk de wit wrote:
>> > I wonder whether the current versions of postgres (i.e. either 8.2
> or 8.3)
>> > are able to utilize multiple cores for the execution of a single query?
>> Nope.
> 
> I see, thanks for the clarification.
> 
> Btw, in this thread:
> http://archives.postgresql.org/pgsql-performance/2007-10/msg00159.php
> 
> the following is said:
> 
>>You can determine what runs in parellel based on the
>>indentation of the output.
>>Items at the same indentation level under the same
>>"parent" line will run in parallel
> 
> Wouldn't this offer some opportunities for running things on multiple
> cores? Based on the above, many people already seem to think that PG is
> able to utilize multiple cores for 1 query.

Of course, it depends on just what you mean. Since postgresql is a
client-server system, the client can run on one processor and the server on
another. And that _is_ parallelism in a way. For me in one application, my
client uses about 20% of a processor and the server uses around 80%. But in
more detail,

VIRT   RES  SHR SWAP %MEM %CPU     TIME+ P COMMAND

2019m  94m  93m 1.9g  1.2   79   2:29.97 3 postgres: jdbeyer stock [local]
INSERT
2019m 813m 813m 1.2g 10.2    2  23:38.67 0 postgres: writer process

2018m  29m  29m 1.9g  0.4    0   4:07.59 3 /usr/bin/postmaster -p 5432 -D ...
 8624  652  264 7972  0.0    0   0:00.10 2 postgres: logger process

 9624 1596  204 8028  0.0    0   0:01.07 2 postgres: stats buffer process

 8892  840  280 8052  0.0    0   0:00.74 1 postgres: stats collector process
 6608 2320 1980 4288  0.0   22   1:56.27 0 /home/jdbeyer/bin/enter

The P column shows the processor the process last ran on. In this case, I
might get away with using one processor, it is clearly using all four.

Now this is not processing a single query on multiple cores (in this case,
the "query" is running on core #3 only), but the ancillary stuff is running
on multiple cores and some of it should be charged to the query. And the OS
kernel takes time for IO and stuff as well.

> Of course, it can be easily
> "proved" that this does not happen by simply watching at the CPU
> utilization graphs when executing a query. Nevertheless, those people
> may wonder why (some of) those items that already run in parallel not
> actually run in parallel using multiple cores?
> 
>
- --
  .~.  Jean-David Beyer          Registered Linux User 85642.
  /V\  PGP-Key: 9A2FC99A         Registered Machine   241939.
 /( )\ Shrewsbury, New Jersey    http://counter.li.org
 ^^-^^ 11:40:01 up 1 day, 2:02, 5 users, load average: 4.15, 4.14, 4.15
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with CentOS - http://enigmail.mozdev.org

iD8DBQFHUZP/Ptu2XpovyZoRAn2BAKDLCyDrRiSo40u15M5GwY4OkxGlngCfbNHI
7hjIcP1ozr+KYPr43Pck9TA=
=Fawa
-----END PGP SIGNATURE-----



view thread (7+ messages)  latest in thread

Message-ID: <475193FF.1080803@verizon.net>
Permalink:  ../475193FF.1080803@verizon.net/
Also on:    postgresql.org/message-id/475193FF.1080803@verizon.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: jeandavid8@verizon.net
  Subject: Re: Utilizing multiple cores for one query
  In-Reply-To: <475193FF.1080803@verizon.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox