Search Postgresql Archives

Re: Is is safe to use SPI in multiple threads?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 11, 2016 at 2:39 PM, Qiu Xiafei <qiuxiafei@xxxxxxxxx> wrote:
> Because of the one-backend-per-session concept of PG, I think I should bind
> one my DSL session to one bg worker only. It seems work. But is there a way
> to launch a bg worker when a new session starts, just like pg's
> per-session-backend do? Is it possible to run a bg worker for incoming
> sessions and to launch a new bg worker to handle the session when it comes?

There is the concept of dynamic background workers in Postgres. That's
what for example parallel query uses. At planning a number of workers
thought as suited is selected, and then spawned dynamically at
execution, at the limit defined by max_worker_processes though. Have a
look at worker_spi in the code tree, which is a module that does
present a way to spawn workers dynamically. This infrastructure could
allow for example anybody to re-create what autovacuum does with a
launcher process and workers created depending on what needs to be
cleaned up per database as a plugin.
-- 
Michael


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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux