Skip to main content
Connect PostgreSQL by enabling pg_stat_statements, creating a dedicated monitoring user, and running the QueryComment collector.
QueryComment reads aggregate query, engine, and infrastructure telemetry. The collector does not proxy application traffic and does not write to your application tables.

Prepare PostgreSQL

1

Enable pg_stat_statements

QueryComment uses pg_stat_statements to read aggregate statement statistics keyed by queryid.Check whether it is already loaded:
If pg_stat_statements is not listed, add it to postgresql.conf or your managed database parameter group. Also disable utility statement tracking:
Restart PostgreSQL, then create the extension in the database you want to monitor:
Changing shared_preload_libraries requires a PostgreSQL restart. Schedule this during a maintenance window for production databases.
2

Create the monitoring user

Connect as a privileged PostgreSQL user and run:
pg_monitor gives the QueryComment collector read access to PostgreSQL monitoring views. pg_read_all_stats lets the receiver read queryid and statement statistics for statements run by other roles.
3

Verify access

Confirm the monitoring user can read statement statistics:
If this query fails, confirm that pg_stat_statements is installed in the database used by the collector connection string.

Configure the QueryComment collector

Use the QueryComment collector with the bundled PostgreSQL receiver. The collector is available as the ghcr.io/querycomment/collector:0.1.2 Docker image or as a release package for your operating system. Set these environment variables before starting the collector: Example .env file:
Run the collector with Docker:
Or choose the release package for your operating system and architecture. This example uses Linux amd64: