Re: Hmmm... why does CPU-intensive pl/pgsql code parallelise so badly when queries parallelise fine? Anyone else seen this?

Поиск
Список
Период
Сортировка
От Craig James
Тема Re: Hmmm... why does CPU-intensive pl/pgsql code parallelise so badly when queries parallelise fine? Anyone else seen this?
Дата
Msg-id CAFwQ8rfA1k-1zPz+PR=ssdShLRNiVG9Br7h3K0SYQPjV-NtBGQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Hmmm... why does CPU-intensive pl/pgsql code parallelise so badly when queries parallelise fine? Anyone else seen this?  ("Joshua D. Drake" <jd@commandprompt.com>)
Список pgsql-performance
On Wed, Jul 8, 2015 at 10:52 AM, Joshua D. Drake <jd@commandprompt.com> wrote:

On 07/08/2015 10:48 AM, Craig James wrote:

    I admit that I haven't read this whole thread but:

    Using Apache Fast-CGI, you are going to fork a process for each
    instance of the function being executed and that in turn will use
    all CPUs up to the max available resource.

    With PostgreSQL, that isn't going to happen unless you are running
    (at least) 8 functions across 8 connections.


Well, right, which is why I mentioned "even with dozens of clients."
Shouldn't that scale to at least all of the CPUs in use if the function
is CPU intensive (which it is)?

In theory but that isn't PostgreSQL that does that, it will be the kernel scheduler. Although (and I am grasping at straws):

I wonder if the execution is taking place outside of the backend proper or... are you using a pooler?

No pooler, and the functions were in an ordinary SQL extension .so library and loaded as

   CREATE OR REPLACE FUNCTION funcname( ... ) returns ... 
   AS 'libxxx.so', 'funcname LANGUAGE c STRICT IMMUTABLE COST 10000;

Craig


JD



Craig




    JD

    --
    Command Prompt, Inc. - http://www.commandprompt.com/  503-667-4564
    PostgreSQL Centered full stack support, consulting and development.
    Announcing "I'm offended" is basically telling the world you can't
    control your own emotions, so everyone else should do it for you.




--
---------------------------------
Craig A. James
Chief Technology Officer
eMolecules, Inc.
---------------------------------


--
Command Prompt, Inc. - http://www.commandprompt.com/  503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Announcing "I'm offended" is basically telling the world you can't
control your own emotions, so everyone else should do it for you.



--
---------------------------------
Craig A. James
Chief Technology Officer
eMolecules, Inc.
---------------------------------

В списке pgsql-performance по дате отправления:

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Hmmm... why does CPU-intensive pl/pgsql code parallelise so badly when queries parallelise fine? Anyone else seen this?
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: Hmmm... why does CPU-intensive pl/pgsql code parallelise so badly when queries parallelise fine? Anyone else seen this?