select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

CONFIGURATION / CONNECTIONS AND AUTHENTICATION

The TCP port the server listens on; 5432 by default.

Type
integer
Context
postmaster
Measured default
5432
Unit
Metadata snapshot
18

Definition PG 18 manual

The TCP port the server listens on; 5432 by default. Note that the same port number is used for all IP addresses the server listens on. This parameter can only be set at server start.

Measured default history
Version intervalDefault
9.0 – 195432
Analysis & operational context

Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗

How it works

port sets the TCP port the server listens on. One port is used for every TCP listener address and becomes part of client connection strings, service discovery, firewall rules, and health checks.

port is a POSTMASTER-context setting: PostgreSQL reads it during server startup, and a configuration reload or session SET cannot activate a new value.

The listener endpoint combines listen_addresses and port at startup, while pg_hba.conf, TLS, firewalls, routing, and service discovery determine which clients can use it.

Operational considerations

Expecting a reload or SET to activate port, although it requires a controlled server restart.

Assuming a bound address or port grants access; pg_hba.conf and operating-system or network controls still apply.

Changing a startup-only endpoint without updating discovery, health checks, firewalls, clients, and the administrative recovery path.

Changing port globally without a rollback plan and a client or operational compatibility test.

Workload guidance

OLAP: Use an explicit analytical endpoint or network when isolation is required, but keep connection information consistent across failover targets.

OLTP: Set port from the service topology and expose only required interfaces or ports. Validate poolers, health checks, pg_hba.conf, firewalls, failover, and restart sequencing together.

SMALL: Prefer local-only exposure unless remote access is required. Preserve a tested administrative route before changing port and restarting.

Related entries

Further reading

Definition snapshot: english-manuals:c3894c661d3795a16c2dfae11d9… · English manual source