跳转到主要内容

pg_store_plans

track plan statistics of all SQL statements executed

pg_store_plans : track plan statistics of all SQL statements executed

Overview

ID Extension Package Version Category License Language
6260 pg_store_plans pg_store_plans 1.10 STAT BSD-3-Clause C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--sLd-r No Yes Yes Yes yes no

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT MIXED 1.10 19 18 17 16 15 pg_store_plans -
RPM PIGSTY 1.10 19 18 17 16 15 pg_store_plans_$v -
DEB PIGSTY 1.10 19 18 17 16 15 postgresql-$v-pg-store-plan -
Linux / PG PG19 PG18 PG17 PG16 PG15
el8.x86_64 N/A PGDG 1.10 PGDG 1.10 PGDG 1.10 PGDG 1.10
el8.aarch64 N/A PGDG 1.10 PGDG 1.10 PGDG 1.10 PGDG 1.10
el9.x86_64 N/A PGDG 1.10 PGDG 1.10 PGDG 1.10 PGDG 1.10
el9.aarch64 N/A PGDG 1.10 PGDG 1.10 PGDG 1.10 PGDG 1.10
el10.x86_64 N/A PGDG 1.10 PGDG 1.10 PGDG 1.10 PGDG 1.10
el10.aarch64 N/A PGDG 1.10 PGDG 1.10 PGDG 1.10 PGDG 1.10
d12.x86_64 N/A PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10
d12.aarch64 N/A PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10
d13.x86_64 N/A PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10
d13.aarch64 N/A PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10
u22.x86_64 N/A PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10
u22.aarch64 N/A PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10
u24.x86_64 N/A PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10
u24.aarch64 N/A PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10
u26.x86_64 N/A PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10
u26.aarch64 N/A PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10 PIGSTY 1.10
Package Version OS ORG SIZE File URL
pg_store_plans_18 1.10 el8.x86_64 pgdg 46.8 KiB pg_store_plans_18-1.10-5PGDG.rhel8.10.x86_64.rpm
pg_store_plans_18 1.10 el8.x86_64 pigsty 119.9 KiB pg_store_plans_18-1.10-1PGSTY.el8.x86_64.rpm
pg_store_plans_18 1.10 el8.x86_64 pgdg 45.9 KiB pg_store_plans_18-1.10-1PGDG.rhel8.10.x86_64.rpm
pg_store_plans_18 1.10 el8.aarch64 pgdg 45.5 KiB pg_store_plans_18-1.10-5PGDG.rhel8.10.aarch64.rpm
pg_store_plans_18 1.10 el8.aarch64 pigsty 117.4 KiB pg_store_plans_18-1.10-1PGSTY.el8.aarch64.rpm
pg_store_plans_18 1.10 el8.aarch64 pgdg 44.6 KiB pg_store_plans_18-1.10-1PGDG.rhel8.10.aarch64.rpm
pg_store_plans_18 1.10 el9.x86_64 pgdg 47.1 KiB pg_store_plans_18-1.10-5PGDG.rhel9.9.x86_64.rpm
pg_store_plans_18 1.10 el9.x86_64 pigsty 122.9 KiB pg_store_plans_18-1.10-1PGSTY.el9.x86_64.rpm
pg_store_plans_18 1.10 el9.aarch64 pgdg 46.1 KiB pg_store_plans_18-1.10-5PGDG.rhel9.9.aarch64.rpm
pg_store_plans_18 1.10 el9.aarch64 pigsty 121.5 KiB pg_store_plans_18-1.10-1PGSTY.el9.aarch64.rpm
pg_store_plans_18 1.10 el10.x86_64 pgdg 47.9 KiB pg_store_plans_18-1.10-5PGDG.rhel10.3.x86_64.rpm
pg_store_plans_18 1.10 el10.x86_64 pigsty 124.2 KiB pg_store_plans_18-1.10-1PGSTY.el10.x86_64.rpm
pg_store_plans_18 1.10 el10.aarch64 pgdg 46.7 KiB pg_store_plans_18-1.10-5PGDG.rhel10.3.aarch64.rpm
pg_store_plans_18 1.10 el10.aarch64 pgdg 46.8 KiB pg_store_plans_18-1.10-5PGDG.rhel10.2.aarch64.rpm
pg_store_plans_18 1.10 el10.aarch64 pigsty 122.3 KiB pg_store_plans_18-1.10-1PGSTY.el10.aarch64.rpm
pg_store_plans_18 1.10 el10.aarch64 pgdg 45.8 KiB pg_store_plans_18-1.10-1PGDG.rhel10.2.aarch64.rpm
pg_store_plans_18 1.10 el10.aarch64 pgdg 45.8 KiB pg_store_plans_18-1.10-1PGDG.rhel10.1.aarch64.rpm
pg_store_plans_18 1.10 el10.aarch64 pgdg 45.8 KiB pg_store_plans_18-1.10-1PGDG.rhel10.0.aarch64.rpm
postgresql-18-pg-store-plan 1.10 d12.x86_64 pigsty 108.2 KiB postgresql-18-pg-store-plan_1.10-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-store-plan 1.10 d12.aarch64 pigsty 105.4 KiB postgresql-18-pg-store-plan_1.10-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-store-plan 1.10 d13.x86_64 pigsty 108.9 KiB postgresql-18-pg-store-plan_1.10-1PGSTY~trixie_amd64.deb
postgresql-18-pg-store-plan 1.10 d13.aarch64 pigsty 105.6 KiB postgresql-18-pg-store-plan_1.10-1PGSTY~trixie_arm64.deb
postgresql-18-pg-store-plan 1.10 u22.x86_64 pigsty 118.1 KiB postgresql-18-pg-store-plan_1.10-1PGSTY~jammy_amd64.deb
postgresql-18-pg-store-plan 1.10 u22.aarch64 pigsty 116.6 KiB postgresql-18-pg-store-plan_1.10-1PGSTY~jammy_arm64.deb
postgresql-18-pg-store-plan 1.10 u24.x86_64 pigsty 113.9 KiB postgresql-18-pg-store-plan_1.10-1PGSTY~noble_amd64.deb
postgresql-18-pg-store-plan 1.10 u24.aarch64 pigsty 112.6 KiB postgresql-18-pg-store-plan_1.10-1PGSTY~noble_arm64.deb
postgresql-18-pg-store-plan 1.10 u26.x86_64 pigsty 115.3 KiB postgresql-18-pg-store-plan_1.10-1PGSTY~resolute_amd64.deb
postgresql-18-pg-store-plan 1.10 u26.aarch64 pigsty 113.3 KiB postgresql-18-pg-store-plan_1.10-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_store_plans_17 1.10 el8.x86_64 pgdg 46.8 KiB pg_store_plans_17-1.10-5PGDG.rhel8.10.x86_64.rpm
pg_store_plans_17 1.10 el8.x86_64 pigsty 119.9 KiB pg_store_plans_17-1.10-1PGSTY.el8.x86_64.rpm
pg_store_plans_17 1.10 el8.x86_64 pgdg 45.9 KiB pg_store_plans_17-1.10-1PGDG.rhel8.10.x86_64.rpm
pg_store_plans_17 1.10 el8.aarch64 pgdg 45.5 KiB pg_store_plans_17-1.10-5PGDG.rhel8.10.aarch64.rpm
pg_store_plans_17 1.10 el8.aarch64 pigsty 117.4 KiB pg_store_plans_17-1.10-1PGSTY.el8.aarch64.rpm
pg_store_plans_17 1.10 el8.aarch64 pgdg 44.6 KiB pg_store_plans_17-1.10-1PGDG.rhel8.10.aarch64.rpm
pg_store_plans_17 1.10 el9.x86_64 pgdg 47.1 KiB pg_store_plans_17-1.10-5PGDG.rhel9.9.x86_64.rpm
pg_store_plans_17 1.10 el9.x86_64 pigsty 122.9 KiB pg_store_plans_17-1.10-1PGSTY.el9.x86_64.rpm
pg_store_plans_17 1.10 el9.aarch64 pgdg 46.1 KiB pg_store_plans_17-1.10-5PGDG.rhel9.9.aarch64.rpm
pg_store_plans_17 1.10 el9.aarch64 pigsty 121.5 KiB pg_store_plans_17-1.10-1PGSTY.el9.aarch64.rpm
pg_store_plans_17 1.10 el10.x86_64 pgdg 48.0 KiB pg_store_plans_17-1.10-5PGDG.rhel10.3.x86_64.rpm
pg_store_plans_17 1.10 el10.x86_64 pigsty 124.2 KiB pg_store_plans_17-1.10-1PGSTY.el10.x86_64.rpm
pg_store_plans_17 1.10 el10.aarch64 pgdg 46.9 KiB pg_store_plans_17-1.10-5PGDG.rhel10.3.aarch64.rpm
pg_store_plans_17 1.10 el10.aarch64 pgdg 46.9 KiB pg_store_plans_17-1.10-5PGDG.rhel10.2.aarch64.rpm
pg_store_plans_17 1.10 el10.aarch64 pigsty 122.5 KiB pg_store_plans_17-1.10-1PGSTY.el10.aarch64.rpm
pg_store_plans_17 1.10 el10.aarch64 pgdg 45.9 KiB pg_store_plans_17-1.10-1PGDG.rhel10.2.aarch64.rpm
pg_store_plans_17 1.10 el10.aarch64 pgdg 45.9 KiB pg_store_plans_17-1.10-1PGDG.rhel10.1.aarch64.rpm
pg_store_plans_17 1.10 el10.aarch64 pgdg 45.9 KiB pg_store_plans_17-1.10-1PGDG.rhel10.0.aarch64.rpm
postgresql-17-pg-store-plan 1.10 d12.x86_64 pigsty 108.1 KiB postgresql-17-pg-store-plan_1.10-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-store-plan 1.10 d12.aarch64 pigsty 105.3 KiB postgresql-17-pg-store-plan_1.10-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-store-plan 1.10 d13.x86_64 pigsty 108.6 KiB postgresql-17-pg-store-plan_1.10-1PGSTY~trixie_amd64.deb
postgresql-17-pg-store-plan 1.10 d13.aarch64 pigsty 105.7 KiB postgresql-17-pg-store-plan_1.10-1PGSTY~trixie_arm64.deb
postgresql-17-pg-store-plan 1.10 u22.x86_64 pigsty 129.6 KiB postgresql-17-pg-store-plan_1.10-1PGSTY~jammy_amd64.deb
postgresql-17-pg-store-plan 1.10 u22.aarch64 pigsty 128.0 KiB postgresql-17-pg-store-plan_1.10-1PGSTY~jammy_arm64.deb
postgresql-17-pg-store-plan 1.10 u24.x86_64 pigsty 114.0 KiB postgresql-17-pg-store-plan_1.10-1PGSTY~noble_amd64.deb
postgresql-17-pg-store-plan 1.10 u24.aarch64 pigsty 112.8 KiB postgresql-17-pg-store-plan_1.10-1PGSTY~noble_arm64.deb
postgresql-17-pg-store-plan 1.10 u26.x86_64 pigsty 115.2 KiB postgresql-17-pg-store-plan_1.10-1PGSTY~resolute_amd64.deb
postgresql-17-pg-store-plan 1.10 u26.aarch64 pigsty 113.3 KiB postgresql-17-pg-store-plan_1.10-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_store_plans_16 1.10 el8.x86_64 pgdg 46.8 KiB pg_store_plans_16-1.10-5PGDG.rhel8.10.x86_64.rpm
pg_store_plans_16 1.10 el8.x86_64 pigsty 120.0 KiB pg_store_plans_16-1.10-1PGSTY.el8.x86_64.rpm
pg_store_plans_16 1.10 el8.x86_64 pgdg 46.0 KiB pg_store_plans_16-1.10-1PGDG.rhel8.10.x86_64.rpm
pg_store_plans_16 1.8 el8.x86_64 pgdg 45.4 KiB pg_store_plans_16-1.8-1PGDG.rhel8.x86_64.rpm
pg_store_plans_16 1.10 el8.aarch64 pgdg 45.5 KiB pg_store_plans_16-1.10-5PGDG.rhel8.10.aarch64.rpm
pg_store_plans_16 1.10 el8.aarch64 pigsty 117.5 KiB pg_store_plans_16-1.10-1PGSTY.el8.aarch64.rpm
pg_store_plans_16 1.10 el8.aarch64 pgdg 44.6 KiB pg_store_plans_16-1.10-1PGDG.rhel8.10.aarch64.rpm
pg_store_plans_16 1.8 el8.aarch64 pgdg 44.1 KiB pg_store_plans_16-1.8-1PGDG.rhel8.aarch64.rpm
pg_store_plans_16 1.10 el9.x86_64 pgdg 47.2 KiB pg_store_plans_16-1.10-5PGDG.rhel9.9.x86_64.rpm
pg_store_plans_16 1.10 el9.x86_64 pigsty 123.0 KiB pg_store_plans_16-1.10-1PGSTY.el9.x86_64.rpm
pg_store_plans_16 1.10 el9.aarch64 pgdg 46.1 KiB pg_store_plans_16-1.10-5PGDG.rhel9.9.aarch64.rpm
pg_store_plans_16 1.10 el9.aarch64 pigsty 121.5 KiB pg_store_plans_16-1.10-1PGSTY.el9.aarch64.rpm
pg_store_plans_16 1.10 el10.x86_64 pgdg 47.9 KiB pg_store_plans_16-1.10-5PGDG.rhel10.3.x86_64.rpm
pg_store_plans_16 1.10 el10.x86_64 pigsty 124.3 KiB pg_store_plans_16-1.10-1PGSTY.el10.x86_64.rpm
pg_store_plans_16 1.10 el10.aarch64 pgdg 46.9 KiB pg_store_plans_16-1.10-5PGDG.rhel10.3.aarch64.rpm
pg_store_plans_16 1.10 el10.aarch64 pgdg 46.9 KiB pg_store_plans_16-1.10-5PGDG.rhel10.2.aarch64.rpm
pg_store_plans_16 1.10 el10.aarch64 pigsty 122.6 KiB pg_store_plans_16-1.10-1PGSTY.el10.aarch64.rpm
pg_store_plans_16 1.10 el10.aarch64 pgdg 45.9 KiB pg_store_plans_16-1.10-1PGDG.rhel10.2.aarch64.rpm
pg_store_plans_16 1.10 el10.aarch64 pgdg 45.9 KiB pg_store_plans_16-1.10-1PGDG.rhel10.1.aarch64.rpm
pg_store_plans_16 1.10 el10.aarch64 pgdg 45.9 KiB pg_store_plans_16-1.10-1PGDG.rhel10.0.aarch64.rpm
pg_store_plans_16 1.8 el10.aarch64 pgdg 46.0 KiB pg_store_plans_16-1.8-3PGDG.rhel10.aarch64.rpm
postgresql-16-pg-store-plan 1.10 d12.x86_64 pigsty 108.5 KiB postgresql-16-pg-store-plan_1.10-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-store-plan 1.10 d12.aarch64 pigsty 105.5 KiB postgresql-16-pg-store-plan_1.10-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-store-plan 1.10 d13.x86_64 pigsty 108.9 KiB postgresql-16-pg-store-plan_1.10-1PGSTY~trixie_amd64.deb
postgresql-16-pg-store-plan 1.10 d13.aarch64 pigsty 105.7 KiB postgresql-16-pg-store-plan_1.10-1PGSTY~trixie_arm64.deb
postgresql-16-pg-store-plan 1.10 u22.x86_64 pigsty 129.3 KiB postgresql-16-pg-store-plan_1.10-1PGSTY~jammy_amd64.deb
postgresql-16-pg-store-plan 1.10 u22.aarch64 pigsty 127.7 KiB postgresql-16-pg-store-plan_1.10-1PGSTY~jammy_arm64.deb
postgresql-16-pg-store-plan 1.10 u24.x86_64 pigsty 114.1 KiB postgresql-16-pg-store-plan_1.10-1PGSTY~noble_amd64.deb
postgresql-16-pg-store-plan 1.10 u24.aarch64 pigsty 113.0 KiB postgresql-16-pg-store-plan_1.10-1PGSTY~noble_arm64.deb
postgresql-16-pg-store-plan 1.10 u26.x86_64 pigsty 115.2 KiB postgresql-16-pg-store-plan_1.10-1PGSTY~resolute_amd64.deb
postgresql-16-pg-store-plan 1.10 u26.aarch64 pigsty 113.4 KiB postgresql-16-pg-store-plan_1.10-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_store_plans_15 1.10 el8.x86_64 pgdg 47.6 KiB pg_store_plans_15-1.10-5PGDG.rhel8.10.x86_64.rpm
pg_store_plans_15 1.10 el8.x86_64 pigsty 120.5 KiB pg_store_plans_15-1.10-1PGSTY.el8.x86_64.rpm
pg_store_plans_15 1.10 el8.x86_64 pgdg 46.8 KiB pg_store_plans_15-1.10-1PGDG.rhel8.10.x86_64.rpm
pg_store_plans_15 1.8 el8.x86_64 pgdg 46.3 KiB pg_store_plans_15-1.8-1PGDG.rhel8.x86_64.rpm
pg_store_plans_15 1.7 el8.x86_64 pgdg 46.3 KiB pg_store_plans_15-1.7-1PGDG.rhel8.x86_64.rpm
pg_store_plans_15 1.10 el8.aarch64 pgdg 46.3 KiB pg_store_plans_15-1.10-5PGDG.rhel8.10.aarch64.rpm
pg_store_plans_15 1.10 el8.aarch64 pigsty 118.0 KiB pg_store_plans_15-1.10-1PGSTY.el8.aarch64.rpm
pg_store_plans_15 1.10 el8.aarch64 pgdg 45.4 KiB pg_store_plans_15-1.10-1PGDG.rhel8.10.aarch64.rpm
pg_store_plans_15 1.8 el8.aarch64 pgdg 45.0 KiB pg_store_plans_15-1.8-1PGDG.rhel8.aarch64.rpm
pg_store_plans_15 1.7 el8.aarch64 pgdg 44.8 KiB pg_store_plans_15-1.7-1PGDG.rhel8.aarch64.rpm
pg_store_plans_15 1.10 el9.x86_64 pgdg 48.1 KiB pg_store_plans_15-1.10-5PGDG.rhel9.9.x86_64.rpm
pg_store_plans_15 1.10 el9.x86_64 pigsty 123.8 KiB pg_store_plans_15-1.10-1PGSTY.el9.x86_64.rpm
pg_store_plans_15 1.10 el9.aarch64 pgdg 47.2 KiB pg_store_plans_15-1.10-5PGDG.rhel9.9.aarch64.rpm
pg_store_plans_15 1.10 el9.aarch64 pigsty 122.3 KiB pg_store_plans_15-1.10-1PGSTY.el9.aarch64.rpm
pg_store_plans_15 1.10 el10.x86_64 pgdg 49.1 KiB pg_store_plans_15-1.10-5PGDG.rhel10.3.x86_64.rpm
pg_store_plans_15 1.10 el10.x86_64 pigsty 125.1 KiB pg_store_plans_15-1.10-1PGSTY.el10.x86_64.rpm
pg_store_plans_15 1.10 el10.aarch64 pgdg 47.9 KiB pg_store_plans_15-1.10-5PGDG.rhel10.3.aarch64.rpm
pg_store_plans_15 1.10 el10.aarch64 pgdg 47.9 KiB pg_store_plans_15-1.10-5PGDG.rhel10.2.aarch64.rpm
pg_store_plans_15 1.10 el10.aarch64 pigsty 123.3 KiB pg_store_plans_15-1.10-1PGSTY.el10.aarch64.rpm
pg_store_plans_15 1.10 el10.aarch64 pgdg 46.9 KiB pg_store_plans_15-1.10-1PGDG.rhel10.2.aarch64.rpm
pg_store_plans_15 1.10 el10.aarch64 pgdg 46.9 KiB pg_store_plans_15-1.10-1PGDG.rhel10.1.aarch64.rpm
pg_store_plans_15 1.10 el10.aarch64 pgdg 46.9 KiB pg_store_plans_15-1.10-1PGDG.rhel10.0.aarch64.rpm
pg_store_plans_15 1.8 el10.aarch64 pgdg 47.2 KiB pg_store_plans_15-1.8-3PGDG.rhel10.aarch64.rpm
postgresql-15-pg-store-plan 1.10 d12.x86_64 pigsty 109.7 KiB postgresql-15-pg-store-plan_1.10-1PGSTY~bookworm_amd64.deb
postgresql-15-pg-store-plan 1.10 d12.aarch64 pigsty 106.3 KiB postgresql-15-pg-store-plan_1.10-1PGSTY~bookworm_arm64.deb
postgresql-15-pg-store-plan 1.10 d13.x86_64 pigsty 110.1 KiB postgresql-15-pg-store-plan_1.10-1PGSTY~trixie_amd64.deb
postgresql-15-pg-store-plan 1.10 d13.aarch64 pigsty 106.8 KiB postgresql-15-pg-store-plan_1.10-1PGSTY~trixie_arm64.deb
postgresql-15-pg-store-plan 1.10 u22.x86_64 pigsty 131.1 KiB postgresql-15-pg-store-plan_1.10-1PGSTY~jammy_amd64.deb
postgresql-15-pg-store-plan 1.10 u22.aarch64 pigsty 129.3 KiB postgresql-15-pg-store-plan_1.10-1PGSTY~jammy_arm64.deb
postgresql-15-pg-store-plan 1.10 u24.x86_64 pigsty 116.3 KiB postgresql-15-pg-store-plan_1.10-1PGSTY~noble_amd64.deb
postgresql-15-pg-store-plan 1.10 u24.aarch64 pigsty 114.2 KiB postgresql-15-pg-store-plan_1.10-1PGSTY~noble_arm64.deb
postgresql-15-pg-store-plan 1.10 u26.x86_64 pigsty 116.7 KiB postgresql-15-pg-store-plan_1.10-1PGSTY~resolute_amd64.deb
postgresql-15-pg-store-plan 1.10 u26.aarch64 pigsty 114.8 KiB postgresql-15-pg-store-plan_1.10-1PGSTY~resolute_arm64.deb

Source

pig build pkg pg_store_plans;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

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

Install this extension with pig:

pig install pg_store_plans;		# install via package name, for the active PG version

pig install pg_store_plans -v 18;   # install for PG 18
pig install pg_store_plans -v 17;   # install for PG 17
pig install pg_store_plans -v 16;   # install for PG 16
pig install pg_store_plans -v 15;   # install for PG 15

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pg_store_plans';

Create this extension with:

CREATE EXTENSION pg_store_plans;

Usage

Sources: official docs, repo, 1.10 release notes

pg_store_plans tracks execution plan statistics for SQL statements, similar to how pg_stat_statements tracks statement statistics. The upstream 1.10 release note says this version adds PostgreSQL 18 support; the documented SQL surface is otherwise the same as current docs.

Required server settings

shared_preload_libraries = 'pg_store_plans'
compute_query_id = 'on'

pg_store_plans requires shared memory, so adding or removing it needs a server restart. The docs say it is silently disabled if compute_query_id is no.

Inspect stored plans

SELECT queryid, planid, plan, calls, total_time, rows
FROM pg_store_plans
ORDER BY total_time DESC;

SELECT * FROM pg_store_plans_info;

The docs describe queryid as the join key for pg_stat_statements, and pg_store_plans_info as a one-row view that exposes module-level stats such as dealloc and stats_reset.

Helper functions

SELECT pg_store_plans_reset();
SELECT pg_store_hash_query('SELECT 1');
SELECT pg_store_plans_textplan(plan);
SELECT pg_store_plans_jsonplan(plan);
SELECT pg_store_plans_xmlplan(plan);
SELECT pg_store_plans_yamlplan(plan);

pg_store_plans_*plan() is useful when pg_store_plans.plan_format = 'raw'.

Key GUCs

  • pg_store_plans.max
  • pg_store_plans.track
  • pg_store_plans.max_plan_length
  • pg_store_plans.plan_storage
  • pg_store_plans.plan_format
  • pg_store_plans.min_duration
  • pg_store_plans.log_analyze
  • pg_store_plans.log_buffers
  • pg_store_plans.log_timing
  • pg_store_plans.save

The docs describe plan_storage as file or shmem, and plan_format as text, json, xml, yaml, or raw.

Caveats

  • Non-superusers cannot see plan, queryid, or planid for statements executed by other users.
  • pg_store_plans and pg_stat_statements maintain entries independently, so low-frequency rows may not always have a matching peer.

表格阅读器