Database disconnection and switch inside a single bgworker

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Database disconnection and switch inside a single bgworker
Дата
Msg-id CAB7nPqRp=SbXZ8v6htCP-dnaF95=HwQ4uRnFJf4da6phrsdvCw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Database disconnection and switch inside a single bgworker  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi all,

Currently, bgworkers offer the possibility to connect to a given
database using BackgroundWorkerInitializeConnection in bgworker.h, but
there is actually no way to disconnect from a given database inside
the same bgworker process.

One of the use cases for that would be the possibility to have the
same bgworker performing for example some analysis on a database A,
like some analysis of statistics using a common database like
postgres, and then perform some actions on another database like,
let's imagine an ANALYSE on a given relation only on database B.

Using the infrastructure of 9.4 as of now, it would be possible of
course to have a bgworker process launching some other child processes
dynamically on different databases, but users (including me) might not
want to do that all the time.

Database disconnection would be also pretty cool for things like
parallel query processing using a pool of bgworker processes that all
the backends could use in parallel as a single ressource.

Note that I didn't have a look at the code yet to see how it would be
possible to do that (looks tricky though), if any infrastructure is
needed or if it could be possible to do that without modifying the
core code of Postgres. So, opinions about that as well as additional
thoughts are welcome!

Regards,
-- 
Michael



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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: information schema parameter_default implementation
Следующее
От: Sawada Masahiko
Дата:
Сообщение: Re: Logging WAL when updating hintbit