pg_show_plans
show query plans of all currently running SQL statements
pg_show_plans : show query plans of all currently running SQL statements
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 6210 | pg_show_plans | pg_show_plans | 2.1.8 |
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_stat_plans auto_explain explain_ui pg_stat_statements pg_store_plans pg_overexplain pg_qualstats online_advisor pgrowlocks pg_wait_sampling |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 2.1.8 |
18 17 16 15 14 | pg_show_plans |
- |
| RPM | PGDG | 2.1.8 |
18 17 16 15 14 | pg_show_plans_$v |
- |
| DEB | PGDG | 2.1.8 |
18 17 16 15 14 | postgresql-$v-show-plans |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| el8.aarch64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| el9.x86_64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| el9.aarch64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| el10.x86_64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| el10.aarch64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| d12.x86_64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| d12.aarch64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| d13.x86_64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| d13.aarch64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| u22.x86_64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| u22.aarch64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| u24.x86_64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| u24.aarch64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| u26.x86_64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
| u26.aarch64 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 | PGDG 2.1.8 |
Source
github.com/cybertec-postgresql/pg_show_plans
pg_show_plans-2.1.8.tar.gz
Install
Make sure PGDG repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
Usage
pg_show_plans displays the execution plans of all currently running SQL statements in real time. Plans are stored in a shared memory hash table.
Viewing Running Plans
The views return:
| Column | Type | Description |
|---|---|---|
pid |
integer | Server process ID |
level |
integer | Query nest level (0 = top level) |
userid |
oid | User OID |
dbid |
oid | Database OID |
plan |
text | Query plan text |
query |
text | Query string (only in pg_show_plans_q) |
Nested Queries
When a function invokes SQL statements, they appear at deeper nesting levels:
GUC Parameters
| Parameter | Default | Description |
|---|---|---|
pg_show_plans.plan_format |
text |
Output format: text, json, yaml, xml |
pg_show_plans.max_plan_length |
16384 | Max plan length in bytes (affects shared memory) |
pg_show_plans.is_enabled |
true |
Enable or disable the extension at runtime |