Reports the number of semaphores that are needed for the server based on the configured number of allowed connections (max_connections), allowed autovacuum worker processes (autovacuum_max_workers), allowed WAL sender processes (max_wal_senders), allowed background processes (max_worker_processes), etc.
At a glance
| Property | Value |
|---|---|
| Parameter | num_os_semaphores |
| Category | Preset Options |
| Default | (see documentation) |
| Value type | integer |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 18, 19 (added in 18) |
What it does
Reports the number of semaphores that are needed for the server based on the configured number of allowed connections (max_connections), allowed autovacuum worker processes (autovacuum_max_workers), allowed WAL sender processes (max_wal_senders), allowed background processes (max_worker_processes), etc.
(Description quoted from the official PostgreSQL documentation.)
How to apply a change
Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.
Inspect the current value and source with SHOW num_os_semaphores; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'num_os_semaphores';.
Tuning guidance
This is a preset, read-only parameter: it reports a value fixed when PostgreSQL was built or the cluster was initialized, and cannot be tuned at runtime. Read it to verify the server’s build or cluster configuration (for example when matching a replica or debugging a compatibility issue); there is no setting to adjust.