Skip to content

application_name

application_name is the PostgreSQL setting that defines the application name to be reported in statistics and logs.
Note

Fact — official short description: “Sets the application name to be reported in statistics and logs.”

Identity

Type , Valuestring
Upstream pg_settings type
Context , Valueuser
Settable by an ordinary user
Unit , Value—
Raw unit
Range , Value—
Raw limits in the last observed version
Enum values , Value—
— for non-enum types
Category , ValueReporting and Logging / What to Log
Upstream classification
Latest boot value , Value""
empty string

Lifecycle

Fact Value
First observed PG9.0 (research boundary)
Present in PG9.0–19 Beta 3
Removed in No
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–19 Beta 3 "" — empty string

How it works

application_name is client-supplied session metadata, usually set in the startup packet or later with SET. It appears in pg_stat_activity and CSV logs and can be inserted into text logs with the %a escape in log_line_prefix.

The value is shorter than NAMEDATALEN bytes (64 characters in a standard build). PostgreSQL permits printable ASCII; other characters are rendered as C-style hexadecimal escapes. Truncation and escaping mean log consumers must not assume the displayed value exactly matches an application’s original string.

It is a USER-context label and is not authenticated identity: any authorized client can claim a misleading value and a pooled session can retain or overwrite it. Correlate it with authenticated user, database, session ID, remote endpoint, and controlled pool checkout/reset behavior.

Tuning advice

Tip

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

Workload Guidance
OLTP Require each service and pooler to set a short, stable, non-secret application_name at checkout and reset it before reuse. Use controlled naming conventions, but never authorize or audit solely from this value.
OLAP Set a stable job or tool family label and place run-specific high-cardinality identity elsewhere. Correlate long analytical sessions with authenticated role and session ID.
Small nodes Keep labels compact and useful; node size is irrelevant. Avoid embedding tenant IDs, tokens, SQL, or unbounded request identifiers in a 64-character client-controlled field.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; 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–19 Beta 3 unmodified; OLAP: PG9.0–19 Beta 3 unmodified; CRIT: PG9.0–19 Beta 3 unmodified; TINY: PG9.0–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • Treating application_name as authenticated identity or using it alone for authorization, billing, or audit attribution.
  • Exceeding NAMEDATALEN and silently losing distinguishing suffixes through truncation.
  • Assuming arbitrary Unicode is preserved rather than escaped to printable C-style hexadecimal sequences.
  • Leaking secrets or creating unbounded cardinality in logs and pg_stat_activity, or failing to reset the value in a connection pool.

cluster_name · update_process_title · log_line_prefix · log_timezone · log_hostname

References