# 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 {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `bool` | Upstream pg_settings type |
| Context | `sighup` | Takes effect after configuration reload |
| Unit | — | Raw unit |
| Range | — | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Connections and Authentication / Authentication | Upstream classification |
| Latest boot value | `off` | off |
{.fields meta="-"}

## Lifecycle {#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 {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG9.0–16 | `off` | — | off |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

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 {#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. |
{.full-width}

## Pigsty {#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 | — | — |
{.full-width}

> [!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 {#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.

## Related parameters {#related-parameters}

[`password_encryption`](/parameters/password-encryption/) · [`scram_iterations`](/parameters/scram-iterations/) · [`md5_password_warnings`](/parameters/md5-password-warnings/) · [`authentication_timeout`](/parameters/authentication-timeout/) · [`oauth_validator_libraries`](/parameters/oauth-validator-libraries/) · [`krb_server_keyfile`](/parameters/krb-server-keyfile/)

## References {#references}

- [PostgreSQL 16 — db_user_namespace](https://www.postgresql.org/docs/16/runtime-config-connection.html#GUC-DB-USER-NAMESPACE)
- [Machine-readable GUC export](/data/guc.jsonl)
