# trace_connection_negotiation

> trace_connection_negotiation — Logs details of pre-authentication connection handshake. Observed in PG17–19 Beta 3; its last measured boot default is off in PG19 Beta 3, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
---

> [!NOTE]
> **Fact — official short description:** “Logs details of pre-authentication connection handshake.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `bool` | Upstream pg_settings type |
| Context | `postmaster` | Requires a server restart |
| Unit | — | Raw unit |
| Range | — | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Developer Options | Upstream classification |
| Latest boot value | `off` | off |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG17 |
| Present in | PG17–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`705843d294d5`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=705843d294d5d3bc5cce4001596df4df5f1c8b59) — Enhance libpq encryption negotiation tests with new GUC |
| Commit date | 2024-04-08 |
| Discussion | [thread 1](https://www.postgresql.org/message-id/CAEze2Wja8VUoZygCepwUeiCrWa4jP316k0mvJrOW4PFmWP0Tcw@mail.gmail.com) |

## Default history {#default-history}

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

## How it works {#mechanism}

trace_connection_negotiation logs details from the pre-authentication connection negotiation path, providing evidence for protocol, encryption, and handshake debugging before normal authentication logs are available.

It is a server-start setting, so enabling it affects subsequent connection handshakes cluster-wide until restart. It does not alter authentication rules or make negotiation succeed.

Handshake logs can be high-volume and reveal network or client capability details. Use a controlled reproduction and protect the resulting server logs. Its postmaster context fixes the value at server start; changing it requires a restart.

## Tuning advice {#tuning-advice}

> [!TIP]
> **Advice.** These are workload-specific starting points and must be validated with measurements.

| Workload | Guidance |
| --- | --- |
| OLTP | Do not tune production OLTP with trace_connection_negotiation. Enable it only for a bounded reproduction with an owner, log/disk budget, rollback condition, and evidence-capture plan; restore the default immediately afterward. |
| OLAP | Long analytical runs can amplify trace_connection_negotiation's debug overhead and artifacts. Prefer standard EXPLAIN and statistics first, and isolate any developer experiment from normal users. |
| Small nodes | Keep trace_connection_negotiation at its upstream default. A small host has less spare CPU, disk, connection, and log capacity for developer instrumentation. |
{.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: PG17–19 Beta 3 unmodified; OLAP: PG17–19 Beta 3 unmodified; CRIT: PG17–19 Beta 3 unmodified; TINY: PG17–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

## Common pitfalls {#common-pitfalls}

- Leaving trace_connection_negotiation enabled after the bounded diagnostic or recovery task.
- Running the experiment on the only copy of production data.
- Underestimating log, core-file, temporary-file, WAL, CPU, or connection-slot amplification.
- Treating a server that merely starts or completes a query as proof that data and behavior are correct.

## Related parameters {#related-parameters}

[`log_connections`](/parameters/log-connections/) · [`authentication_timeout`](/parameters/authentication-timeout/) · [`ssl`](/parameters/ssl/) · [`pre_auth_delay`](/parameters/pre-auth-delay/) · [`log_error_verbosity`](/parameters/log-error-verbosity/)

## References {#references}

- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
