Summary
The pg_stat_ssl view will contain one row per backend or WAL sender process, showing statistics about SSL usage on this connection. It can be joined to pg_stat_activity or pg_stat_replication on the pid column to get more details about the connection.
(Description quoted from the official PostgreSQL documentation.)
Columns
The pg_stat_ssl statistics view exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):
pidinteger
Process ID of a backend or WAL sender processsslboolean
True if SSL is used on this connectionversiontext
Version of SSL in use, or NULL if SSL is not in use on this connectionciphertext
Name of SSL cipher in use, or NULL if SSL is not in use on this connectionbitsinteger
Number of bits in the encryption algorithm used, or NULL if SSL is not used on this connectionclient_dntext
Distinguished Name (DN) field from the client certificate used, or NULL if no client certificate was supplied or if SSL is not in use on this connection. This field is truncated if the DN field is longer than NAMEDATALEN (64 characters in a standard build).client_serialnumeric
Serial number of the client certificate, or NULL if no client certificate was supplied or if SSL is not in use on this connection. The combination of certificate serial number and certificate issuer uniquely identifies a certificate (unless the issuer erroneously reuses serial numbers).issuer_dntext
DN of the issuer of the client certificate, or NULL if no client certificate was supplied or if SSL is not in use on this connection. This field is truncated like client_dn.
Version applicability
Present in PostgreSQL 17, 18, 19 (verified against each release’s documentation). This is a long-standing system object that also exists in earlier PostgreSQL releases.
Related & references
Reference: PostgreSQL documentation — pg_stat_ssl.