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

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `string` | Upstream pg_settings type |
| Context | `user` | Settable by an ordinary user |
| Unit | — | Raw unit |
| Range | — | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Reporting and Logging / What to Log | Upstream classification |
| Latest boot value | `""` | empty string |
{.fields meta="-"}

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

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

## How it works {#mechanism}

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

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

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

## Related parameters {#related-parameters}

[`cluster_name`](/parameters/cluster-name/) · [`update_process_title`](/parameters/update-process-title/) · [`log_line_prefix`](/parameters/log-line-prefix/) · [`log_timezone`](/parameters/log-timezone/) · [`log_hostname`](/parameters/log-hostname/)

## References {#references}

- [PostgreSQL 19 Beta 3 — application_name](https://www.postgresql.org/docs/19/runtime-config-logging.html#GUC-APPLICATION-NAME)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
