To enable pghealth to function properly, a few PostgreSQL extensions need to be installed on the database for which you want to perform a health check.
These required extensions are:
1- pg_buffercache
2- pg_stat_statements
3- pgstattuple
4- system_stats
Decide which PostgreSQL database you want pghealth to monitor.
Connect to your target database and run the following SQL commands to install the extensions. These commands ensure that each extension is installed in the public schema:
CREATE EXTENSION IF NOT EXISTS pg_buffercache SCHEMA public;
CREATE EXTENSION IF NOT EXISTS pg_stat_statements SCHEMA public;
CREATE EXTENSION IF NOT EXISTS pgstattuple SCHEMA public;
CREATE EXTENSION IF NOT EXISTS system_stats SCHEMA public;
Some extensions come bundled with PostgreSQL and are typically available when the contrib package is installed. For example:
1- pg_buffercache
2- pgstattuple
3- pg_stat_statements
These are official PostgreSQL contrib modules and are usually available out of the box or can be easily installed via your system’s package manager by installing the postgresql-contrib package.
However, the system_stats extension is not included by default. It is provided by EnterpriseDB and must be installed manually. You can download it from the following link:
👉 EnterpriseDB system_stats GitHub repository
If you've successfully installed all the required extensions, great — you can move on to the next step.