Contents
Background worker
A user-defined process which runs as part of the main postgres server process
A background worker
(commonly abbreviated to BGW
) is a user-defined process which runs as part of the main postgres server process.
Background worker
functionality was added in PostgreSQL 9.3.
Change history
- PostgreSQL 11
bgw_type
field added; the value set here will be visible inpg_stat_activity
'sbackend_type
column instead of the generic value "background worker
", and also shown as theps
process display label (commit 5373bc2a)- background workers can attach to databases which normally disallow connections (
datallowconn
=false
) (commit eed1ce72)
- PostgreSQL 10
- background workers visible in
pg_stat_activity
(commit fc70a4b0)
- background workers visible in
- PostgreSQL 9.4
- background workers can be started dynamically (commit 7f7485a0)
- GUC
max_worker_processes
added (commit 6bc8ef0b)
- PostgreSQL 9.3
- initial support added (commit da07a1e8)
Examples
Some sample code can be found in the test module "worker_spi
" (src/test/modules/worker_spi).
References
- PostgreSQL documentation: Background Worker Processes