Skip to content

Connecting#

Connection settings#

pgcue reads the same environment variables, service file and password file as psql, so an existing setup works unchanged. --dsn overrides them and accepts either form of connection string:

$ pgcue doctor --dsn "postgres://monitor@db.internal:5432/orders?sslmode=verify-full"
$ pgcue doctor --dsn "host=db.internal dbname=orders user=monitor sslmode=verify-full"

The server's statement_timeout applies alongside --timeout.

Encryption#

By default, the connection uses TLS when the server offers it, without verifying the server's certificate. Over an untrusted network, set sslmode=verify-full and give the server's CA certificate with sslrootcert, or PGSSLROOTCERT.

What pgcue changes in its session#

pgcue never writes to the database. Its session sets:

Setting Value Why
default_transaction_read_only on Every statement runs read-only.
search_path pg_catalog, pg_temp Objects in other schemas can't shadow catalog names.
application_name pgcue You can recognise its sessions in pg_stat_activity.

Privileges#

Any role that can connect can run checks. Without membership of pg_monitor, PostgreSQL hides other sessions' queries and some monitoring details, and doctor warns that results may be incomplete:

GRANT pg_monitor TO monitor;

Optional extensions#

Extension Needed by
pg_stat_statements statements.top

Create pg_stat_statements in the database pgcue connects to. It must also be in shared_preload_libraries, which needs a restart.

Server versions#

pgcue supports PostgreSQL 14 and later. Where catalog views differ between versions, a check carries SQL for each, and pgcue uses the one that matches the server.