PostgreSQL Setup for pghealth – Extensions & Configuration 4 Min Guide

Опубликовано: 24 Июль 2026
на канале: pghealth
1,707
2

In this video, we walk through the official Getting Started guide for pghealth and configure a PostgreSQL instance step by step.

We assume you already have a running self-managed PostgreSQL database.
In 4 minutes, we install the required extensions and apply the necessary configuration settings.


🔧 PostgreSQL Configuration (postgresql.conf)

shared_preload_libraries = 'pg_stat_statements,auto_explain'

logging_collector = on
log_directory = 'log'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_rotation_age = 1d
log_rotation_size = 100MB

log_statement = 'ddl'
log_min_duration_statement = 1000
log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h queryid=%Q'
log_connections = on
log_disconnections = on

auto_explain.log_format = 'json'
auto_explain.log_min_duration = '1000'
auto_explain.log_buffers = on
auto_explain.log_timing = off
auto_explain.log_triggers = on
auto_explain.log_verbose = on
auto_explain.log_nested_statements = on
auto_explain.sample_rate = 1


🧩 Installing system_stats Extension (Linux)

sudo apt-get update
sudo apt install make
sudo apt-get install -y gcc make postgresql-server-dev-18 libpq-dev

cd /home/ubuntu
git clone https://github.com/EnterpriseDB/system_sta...

cd system_stats-1.0
PATH="/usr/local/pgsql/bin:$PATH" make USE_PGXS=1
sudo PATH="/usr/local/pgsql/bin:$PATH" make install USE_PGXS=1

📘 Resources

PostgreSQL Health Check Pillar Guide
https://pghealth.io/docs/postgresql-health

PostgreSQL Health Check Tool
https://pghealth.io/

Documentation Overview
https://pghealth.io/docs/Overview


🐘 Keywords

PostgreSQL health check
PostgreSQL monitoring
pg_stat_statements setup
auto_explain configuration
PostgreSQL performance tuning
PostgreSQL logging configuration
PostgreSQL slow query logging
PostgreSQL 13 14 15 16 17 18