system_stats

EnterpriseDB system statistics for PostgreSQL

Overview

PackageVersionCategoryLicenseLanguage
system_stats3.2STATPostgreSQLC
IDExtensionBinLibLoadCreateTrustRelocSchema
6420system_statsNoYesNoYesNoYes-
Relatedpgnodemx pg_proctab pgmeminfo pgfincore pg_wait_sampling pg_buffercache pg_background pg_cooldown

Version

TypeRepoVersionPG VerPackageDeps
EXTMIXED3.21817161514system_stats-
RPMPGDG3.21817161514system_stats_$v-
DEBPIGSTY3.21817161514postgresql-$v-system-stats-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
d12.aarch64
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
d13.x86_64
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
d13.aarch64
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
u22.x86_64
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
u22.aarch64
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
u24.x86_64
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
u24.aarch64
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2
PIGSTY 3.2

Build

You can build the DEB packages for system_stats using pig build:

pig build pkg system_stats         # build DEB packages

Install

You can install system_stats directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

pig repo add pgsql -u          # Add repo and update cache

Install the extension using pig or apt/yum/dnf:

pig install system_stats;          # Install for current active PG version
pig ext install -y system_stats -v 18  # PG 18
pig ext install -y system_stats -v 17  # PG 17
pig ext install -y system_stats -v 16  # PG 16
pig ext install -y system_stats -v 15  # PG 15
pig ext install -y system_stats -v 14  # PG 14
dnf install -y system_stats_18       # PG 18
dnf install -y system_stats_17       # PG 17
dnf install -y system_stats_16       # PG 16
dnf install -y system_stats_15       # PG 15
dnf install -y system_stats_14       # PG 14
apt install -y postgresql-18-system-stats   # PG 18
apt install -y postgresql-17-system-stats   # PG 17
apt install -y postgresql-16-system-stats   # PG 16
apt install -y postgresql-15-system-stats   # PG 15
apt install -y postgresql-14-system-stats   # PG 14

Create Extension:

CREATE EXTENSION system_stats;

Usage

system_stats: system-level statistics for PostgreSQL

system_stats provides SQL functions to access OS-level statistics for monitoring. Supports Linux, macOS, and Windows.

Functions

-- Operating system info (name, version, hostname, uptime, etc.)
SELECT * FROM pg_sys_os_info();

-- CPU info (vendor, model, cores, clock speed, cache sizes)
SELECT * FROM pg_sys_cpu_info();

-- CPU usage (user, system, idle, iowait percentages)
SELECT * FROM pg_sys_cpu_usage_info();

-- Memory info (total, used, free, swap, cache in bytes)
SELECT * FROM pg_sys_memory_info();

-- Disk I/O analysis (reads, writes, bytes, time per device)
SELECT * FROM pg_sys_io_analysis_info();

-- Disk info (filesystem, mount point, total/used/available space)
SELECT * FROM pg_sys_disk_info();

-- Load average (1, 5, 10, 15 minute intervals)
SELECT * FROM pg_sys_load_avg_info();

-- Process info (total, running, sleeping, stopped, zombie counts)
SELECT * FROM pg_sys_process_info();

-- Network info (interface, IP, bytes/packets sent/received, errors)
SELECT * FROM pg_sys_network_info();

-- Per-process CPU and memory usage
SELECT * FROM pg_sys_cpu_memory_by_process();

Security

Access is restricted to superusers and members of the monitor_system_stats role:

-- Grant access to a monitoring user
GRANT monitor_system_stats TO nagios;

-- Or grant per-function to pg_monitor
GRANT EXECUTE ON FUNCTION pg_sys_os_info() TO pg_monitor;

Example: System Overview

SELECT * FROM pg_sys_load_avg_info();  -- load averages
SELECT memfree, memused, swapfree FROM pg_sys_memory_info();  -- memory
SELECT * FROM pg_sys_cpu_usage_info();  -- CPU usage breakdown

Last Modified 2026-03-12: add pg extension catalog (95749bf)