pg_wait_sampling
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_wait_sampling | 1.1.11 | STAT | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 6280 | pg_wait_sampling | No | Yes | Yes | Yes | No | Yes | - |
| Related | pg_profile pgsentinel pg_stat_monitor pg_datasentinel powa pgrowlocks pg_visibility pg_show_plans pg_stat_statements pg_stat_plans |
|---|
PIGSTY RPM and PGDG DEB package version 1.1.11 cover PostgreSQL 14-18; SQL/control version is 1.1 and shared_preload_libraries=pg_wait_sampling is required.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | MIXED | 1.1.11 | 1817161514 | pg_wait_sampling | - |
| RPM | PIGSTY | 1.1.11 | 1817161514 | pg_wait_sampling_$v | - |
| DEB | PGDG | 1.1.11 | 1817161514 | postgresql-$v-pg-wait-sampling | - |
Build
You can build the RPM packages for pg_wait_sampling using pig build:
Install
You can install pg_wait_sampling directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
pg_wait_sampling collects wait event statistics by periodically sampling what each backend is waiting on. It provides both a recent history ring buffer and a cumulative profile.
Views
Current wait events:
| Column | Type | Description |
|---|---|---|
pid | int4 | Process ID |
event_type | text | Wait event type |
event | text | Wait event name |
queryid | int8 | Query ID |
Wait event history (ring buffer of recent samples):
| Column | Type | Description |
|---|---|---|
pid | int4 | Process ID |
ts | timestamptz | Sample timestamp |
event_type | text | Wait event type |
event | text | Wait event name |
queryid | int8 | Query ID |
Wait event profile (cumulative counts):
| Column | Type | Description |
|---|---|---|
pid | int4 | Process ID |
event_type | text | Wait event type |
event | text | Wait event name |
queryid | int8 | Query ID |
count | text | Count of samples |
Get current wait event for a specific process:
Reset Profile
Configuration
| Parameter | Default | Description |
|---|---|---|
pg_wait_sampling.history_size | 5000 | Ring buffer size |
pg_wait_sampling.history_period | 10 | History sampling period (ms) |
pg_wait_sampling.profile_period | 10 | Profile sampling period (ms) |
pg_wait_sampling.profile_pid | true | Collect profile per-process |
pg_wait_sampling.profile_queries | top | Per-query profile: none, top, all |
pg_wait_sampling.sample_cpu | true | Sample on-CPU backends (event columns NULL) |
Example: Top Wait Events
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)