CPU killer

Started by Vilson fariasover 25 years ago5 messagesgeneral
Jump to latest
#1Vilson farias
vilson.farias@digitro.com.br

Greetings,

I've been using Postgres in a Pentium 75Mhz, Linux RedHat 6.2, 32Mb.

Every big query I execute uses too much cpu (more than 90%).

I start postgres with these params: su -l postgres -c
'/usr/bin/postmaster -B 2048 -i -D "/home/postgres/data"' &.

What should I do for avoid postgres extreme cpu allocation? I know sometimes
non-indexed tables or huge size tables can be slow, but here I don't care
about execution speed, I just want less cpu allocation no matter how slow.

Regards from Brazil,

Jos� Vilson de Mello de Farias
D�gitro Tecnologia Ltda.

#2Alfred Perlstein
bright@wintelcom.net
In reply to: Vilson farias (#1)
Re: CPU killer

* Vilson farias <vilson.farias@digitro.com.br> [001027 21:38] wrote:

Greetings,

I've been using Postgres in a Pentium 75Mhz, Linux RedHat 6.2, 32Mb.

Every big query I execute uses too much cpu (more than 90%).

I start postgres with these params: su -l postgres -c
'/usr/bin/postmaster -B 2048 -i -D "/home/postgres/data"' &.

What should I do for avoid postgres extreme cpu allocation? I know sometimes
non-indexed tables or huge size tables can be slow, but here I don't care
about execution speed, I just want less cpu allocation no matter how slow.

Unix is a timesharing system, if you want an application on unix
to use less CPU then put it on a box with a slower CPU. If you
want to limit its priority against other processes so that it
shares CPU in a more friendly manner, then you want to read the
manpage for nice(1).

--
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."

#3Igor Roboul
igor@raduga.dyndns.org
In reply to: Vilson farias (#1)
Re: CPU killer

On Fri, Oct 27, 2000 at 07:12:57PM -0200, Vilson farias wrote:

I start postgres with these params: su -l postgres -c
'/usr/bin/postmaster -B 2048 -i -D "/home/postgres/data"' &.

Try starting postmaster with 'nice':
nice /usr/bin/postmaster -B 2048 -i -D /home/postgres/data &

--
Igor Roboul, Unix System Administrator & Programmer @ sanatorium "Raduga",
Sochi, Russia
http://www.brainbench.com/transcript.jsp?pid=304744

#4Tod McQuillin
devin@spamcop.net
In reply to: Vilson farias (#1)
Re: CPU killer

On Fri, 27 Oct 2000, Vilson farias wrote:

I've been using Postgres in a Pentium 75Mhz, Linux RedHat 6.2, 32Mb.

Every big query I execute uses too much cpu (more than 90%).

I start postgres with these params: su -l postgres -c
'/usr/bin/postmaster -B 2048 -i -D "/home/postgres/data"' &.

What should I do for avoid postgres extreme cpu allocation? I know
sometimes non-indexed tables or huge size tables can be slow, but here
I don't care about execution speed, I just want less cpu allocation no
matter how slow.

Well, assuming you've already optimised the queries to run as quickly as
possible, if you don't want the backend stealing cpu from other processes
then start postmaster with the nice command (man nice) to give it a lower
priority. It will still use just as much CPU time, but not at the expense
of other processes.
--
Tod McQuillin

#5Steve Wolfe
steve@iboats.com
In reply to: Vilson farias (#1)
Re: CPU killer

I've been using Postgres in a Pentium 75Mhz, Linux RedHat 6.2, 32Mb.

Every big query I execute uses too much cpu (more than 90%).

I start postgres with these params: su -l postgres -c
'/usr/bin/postmaster -B 2048 -i -D "/home/postgres/data"' &.

What should I do for avoid postgres extreme cpu allocation? I know

sometimes

non-indexed tables or huge size tables can be slow, but here I don't

care

about execution speed, I just want less cpu allocation no matter how

slow.

First, there's a problem in how you're starting it up. You're telling
Postgres (via the "-B 2048) to allocate 16 megabytes for shared memory
buffers - which leaves only 16 megs for your OS, the database, and every
other process on the system. Large queries are probably filling that up,
forcing the machine to swap quite a bit. Try dropping it to "-B 128" or "-b
256", and see if that makes a difference. And, as was already stated, nice
or renice will help if you want to make sure that other processes get time
on the CPU - but if your query is causing heavy disk I/O on an IDE drive,
you can still expect system responsiveness to drop significantly.

steve