pgsentinel
active session history
pgsentinel : active session history
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 6410 | pgsentinel | pgsentinel | 1.4.2 |
STAT | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-r | No | Yes | Yes | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pg_datasentinel pg_profile pg_stat_monitor pg_wait_sampling pg_stat_ch pgmonitor system_stats pgnodemx powa pg_stat_statements |
Package/source release and PIGSTY RPM are 1.4.2; shipped pgsentinel.control and PGDG DEB remain 1.4.1.
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | MIXED | 1.4.2 |
18 17 16 15 14 | pgsentinel |
- |
| RPM | PIGSTY | 1.4.2 |
18 17 16 15 14 | pgsentinel_$v |
- |
| DEB | PGDG | 1.4.2 |
18 17 16 15 14 | postgresql-$v-pgsentinel |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 |
| el8.aarch64 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 |
| el9.x86_64 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 |
| el9.aarch64 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 |
| el10.x86_64 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 |
| el10.aarch64 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 | PIGSTY 1.4.2 |
| d12.x86_64 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 |
| d12.aarch64 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 |
| d13.x86_64 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 |
| d13.aarch64 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 |
| u22.x86_64 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 |
| u22.aarch64 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 |
| u24.x86_64 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 |
| u24.aarch64 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 |
| u26.x86_64 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 |
| u26.aarch64 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 | PGDG 1.4.2 |
Source
github.com/pgsentinel/pgsentinel
pgsentinel-1.4.2.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
Usage
Sources:
- pgsentinel 1.4.2 README
- pgsentinel 1.4.2 release
- pgsentinel 1.4.1 to 1.4.2 changes
- pgsentinel control file
pgsentinel records active session history by sampling pg_stat_activity at regular intervals and linking activity with pg_stat_statements query statistics. It keeps recent samples in shared-memory ring buffers managed by a background worker.
Restart PostgreSQL, then enable both extensions in the database used by the worker:
Active Session History
Key columns beyond pg_stat_activity:
| Column | Description |
|---|---|
ash_time |
Sampling timestamp |
top_level_query |
Top-level statement (for PL/pgSQL) |
query |
Statement with actual parameter values |
cmdtype |
Statement type: SELECT, UPDATE, INSERT, DELETE, UTILITY, UNKNOWN, NOTHING |
queryid |
Links to pg_stat_statements |
blockers |
Number of blocking processes |
blockerpid |
PID of a blocking process |
blocker_state |
State of the blocker |
Query Statistics History
When enabled, pgsentinel also samples pg_stat_statements concurrently:
Example: Wait Analysis
Configuration
| Parameter | Default | Description |
|---|---|---|
pgsentinel_ash.sampling_period |
1 | Sampling period in seconds |
pgsentinel_ash.max_entries |
1000 | Ring buffer size for ASH |
pgsentinel.db_name |
postgres |
Database for worker connection |
pgsentinel_ash.track_idle_trans |
false |
Track idle-in-transaction sessions |
pgsentinel_pgssh.max_entries |
1000 | Ring buffer for pg_stat_statements history |
pgsentinel_pgssh.enable |
false |
Enable pg_stat_statements history |
Version and Operational Notes
- Release 1.4.2 fixes query-statistics history on PostgreSQL 17, whose
pg_stat_statementsview renamed block I/O timing columns toshared_blk_read_timeandshared_blk_write_time. - The same release adds PostgreSQL 19 build compatibility without changing the SQL views or GUC surface.
- Ring-buffer history is memory-resident and finite; increase the entry limits only after accounting for shared-memory use, and export samples externally when longer retention is required.
- Query text can contain literal parameter values. Restrict access to the history views when statements may include sensitive data.