On Mon, 29 Jun 2009, Hartman, Matthew wrote:

The function throttles one of my CPUs to 100% (shown as 50% in Task Manager) and leaves the other one sitting pretty. Is there any way to use both CPUs?

Not easily.  Potential techniques:

-Rewrite the function or its time critical portion in some other language that allows using two processes usefully

-Write a "worker server" that you prompt to pick up work from a table and write its output to another that you can ask to handle part of the job. You might communicate with the worker using the LISTEN/NOTIFY mechanism in the database.

-Some combination of these two techniques. One popular way to speed up things that are running slowly is to run some part of them in a C UDF, so that you could use "select my_big_computation(x,y,z)" and get faster execution.

If you were hoping for a quick answer, no such thing. I suspect you'd get better help talking about what your function does and see if there's a specific part somebody else is familiar with optimizing.

For example, I've seen >10:1 speedups just be rewriting one small portion of a computationally expensive mathematical function in C before, keeping the rest of the logic on the database side. You don't necessarily have to rewrite the whole thing.

--
* Greg Smith gsm...@gregsmith.com http://www.gregsmith.com Baltimore, MD

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

Reply via email to