Why is it not using the other processor?

Started by Linh Luongalmost 25 years ago5 messagesgeneral
Jump to latest
#1Linh Luong
linh.luong@computalog.com

Hi,

My postgres is running on a dual processor. But when I run a query and
look at TOP and notice only one processor is being used. And it is
being used 100% (assuming only 1 process is active). Why would it
allocate the work to the other processor. Am I missing something
here. If so how can I make it use the other one too?

One more question. I am using the browser to display my data. If I
start the query by means of pressing the Search button and then I decide
to stop the search by pressing STOP (on the broswer). The browser stop
executing and I can still surf the web. My question is why is the
process that handles the search still running when I view TOP. It
doesn't go away until it has completed it query. Is there a way I make
postgres realize that netscape has terminated and it should also die.
My search for example takes 10 secs. But if I stop and start it often
the time it requires to search increase dramatically. I am trying to
look for a solution on the postgres or apache side.

Please help me..

Thanks

Linh

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Linh Luong (#1)
Re: Why is it not using the other processor?

Linh Luong writes:

My postgres is running on a dual processor. But when I run a query and
look at TOP and notice only one processor is being used. And it is
being used 100% (assuming only 1 process is active). Why would it
allocate the work to the other processor.

Ask your operating system provider. PostgreSQL just allocates processes,
it doesn't decide on what CPU they'll run.

One more question. I am using the browser to display my data. If I
start the query by means of pressing the Search button and then I decide
to stop the search by pressing STOP (on the broswer). The browser stop
executing and I can still surf the web. My question is why is the
process that handles the search still running when I view TOP.

You are probably using PHP with persistent connections. They could stay
open indefinitely. You might have to kill the postgres process or the web
server manually.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#3Doug McNaught
doug@wireboard.com
In reply to: Peter Eisentraut (#2)
Re: Why is it not using the other processor?

Peter Eisentraut <peter_e@gmx.net> writes:

Linh Luong writes:

My postgres is running on a dual processor. But when I run a query and
look at TOP and notice only one processor is being used. And it is
being used 100% (assuming only 1 process is active). Why would it
allocate the work to the other processor.

Ask your operating system provider. PostgreSQL just allocates processes,
it doesn't decide on what CPU they'll run.

But thre answer to his question is that a single query will use at
most 1 CPU, since each backend is a single process. Multiple
simultaneous queries will of course use all available CPUs on a
properly-setup system.

-Doug
--
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time... --Dylan

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Doug McNaught (#3)
Re: Why is it not using the other processor?

Doug McNaught writes:

But thre answer to his question is that a single query will use at
most 1 CPU, since each backend is a single process. Multiple
simultaneous queries will of course use all available CPUs on a
properly-setup system.

It's a quality of implementation issue. An operating system could
theoretically support running one process on more than one CPU, but
needless to say it would be tricky.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#5(J.H.M. Dassen \(Ray\))
jdassen@cistron.nl
In reply to: Linh Luong (#1)
Re: Why is it not using the other processor?

Linh Luong <linh.luong@computalog.com> wrote:

My postgres is running on a dual processor. But when I run a query and
look at TOP and notice only one processor is being used. And it is
being used 100% (assuming only 1 process is active).

PostgreSQL does not use threads; there is just one backend process per
session/connection. So if there is only one session connected, only one
backend process will be active, and only one processor will be used. Your
second processor will be used as soon as there is more than one session
connected.

HTH,
Ray
--
<GRub[B]eR> JHM, jij bent echt nerd :))
<GRub[B]eR> maar wel een goeie :)
<GRub[B]eR> Soort van programmerende furby
Gezien op #cistron