pg_proctab
pg_proctab
pgnodemx : PostgreSQL extension to access the OS process table
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 6450 | pg_proctab | pgnodemx | 1.7 | STAT | BSD 3-Clause | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | prioritize system_stats pg_background pg_wait_sampling pgmeminfo pgsentinel pg_profile |
| Siblings | pgnodemx |
from pgnodemx
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.7 | 18 17 16 15 14 | pgnodemx | - |
| RPM | PIGSTY | 1.7 | 18 17 16 15 14 | pgnodemx_$v | - |
| DEB | PIGSTY | 1.7 | 18 17 16 15 14 | postgresql-$v-pgnodemx | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 |
el8.aarch64 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 |
el9.x86_64 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 |
el9.aarch64 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 |
el10.x86_64 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 |
el10.aarch64 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 | PIGSTY 1.7 |
d12.x86_64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
d12.aarch64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
d13.x86_64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
d13.aarch64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
u22.x86_64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
u22.aarch64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
u24.x86_64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
u24.aarch64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
Source
pig build pkg pgnodemx; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pgnodemx; # install via package name, for the active PG version
pig install pg_proctab; # install by extension name, for the current active PG version
pig install pg_proctab -v 18; # install for PG 18
pig install pg_proctab -v 17; # install for PG 17
pig install pg_proctab -v 16; # install for PG 16
pig install pg_proctab -v 15; # install for PG 15
pig install pg_proctab -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION pg_proctab;Usage
pg_proctab allows querying operating system process, CPU, memory, disk, and load statistics from within PostgreSQL via SQL functions.
Functions
Process information (pg_proctab()):
-- All PostgreSQL process info
SELECT pid, comm, state, utime, stime, vsize, rss, reads, writes
FROM pg_proctab();
-- Join with pg_stat_activity for per-query resource usage
SELECT a.pid, a.query, p.utime, p.stime, p.vsize, p.rss
FROM pg_stat_activity a
JOIN pg_proctab() p ON a.pid = p.pid;Returns per-process: pid, comm, fullcomm, state, ppid, utime, stime, priority, nice, num_threads, vsize, rss, processor, uid, username, rchar, wchar, reads, writes, and more.
CPU time (pg_cputime()):
SELECT "user", nice, system, idle, iowait FROM pg_cputime();Load average (pg_loadavg()):
SELECT load1, load5, load15, last_pid FROM pg_loadavg();Memory usage (pg_memusage()):
SELECT memused, memfree, memshared, membuffers, memcached,
swapused, swapfree, swapcached
FROM pg_memusage();Disk usage (pg_diskusage()):
SELECT devname, reads_completed, writes_completed,
sectors_read, sectors_written
FROM pg_diskusage();Last updated on