Skip to content

db_user_namespace

db_user_namespace is the PostgreSQL setting that controls whether PostgreSQL enables per-database user names.
Note

Fact — official short description: “Enables per-database user names.”

Identity

Type , Valuebool
Upstream pg_settings type
Context , Valuesighup
Takes effect after configuration reload
Unit , Value
Raw unit
Range , Value
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueConnections and Authentication / Authentication
Upstream classification
Latest boot value , Valueoff
off

Lifecycle

Fact Value
First observed PG9.0 (research boundary)
Present in PG9.0–16
Removed in PG17
Introduction commit Not asserted: predates the PG9.0 research boundary
Commit date
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.0–16 off off

How it works

db_user_namespace enables per-database user names. This legacy feature represented users internally as user@database and was removed in PostgreSQL 17; it is not a modern tenant-isolation mechanism.

db_user_namespace is a SIGHUP-context setting: a configuration reload activates the new server value without a restart; subsequent operations that consult it use the refreshed value.

The final authentication path combines this setting with pg_hba.conf, role attributes, credential material, client capabilities, and sometimes operating-system identity services.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
OLTP Do not adopt or tune db_user_namespace: it was a legacy compatibility feature and is absent from PostgreSQL 17+. Migrate to ordinary cluster-wide roles with explicit authorization.
OLAP Do not build analytical tenancy on db_user_namespace. Use roles, schemas, databases, and row-level security according to the required boundary.
Small nodes Leave db_user_namespace off on old releases and remove dependencies before upgrading; it provides no useful small-node optimization.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG16; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP Unmodified
OLAP Unmodified
CRIT Unmodified
TINY Unmodified
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–16 unmodified; OLAP: PG9.0–16 unmodified; CRIT: PG9.0–16 unmodified; TINY: PG9.0–16 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • Editing db_user_namespace without reloading configuration and verifying the effective value and subsequent behavior.
  • Changing one authentication setting without testing pg_hba.conf ordering, existing secrets, mappings, and every client library.
  • Weakening identity policy to solve connection churn or CPU cost that should be addressed with pooling and capacity planning.
  • Changing db_user_namespace globally without a rollback plan and a client or operational compatibility test.

password_encryption · scram_iterations · md5_password_warnings · authentication_timeout · oauth_validator_libraries · krb_server_keyfile

References