← Browse the extensions catalog

pg-statviz

Source README ↗

pg-statviz

pg_statviz captures PostgreSQL statistics in database tables for later SQL analysis. The report generator and chart output are provided by a user-operated external client; this image adds no listener or web UI.

Follow the quick start to set up extension-update email alerts first, then use the CronJob to install and refresh the catalog. These examples inherit image references and runtime settings from the catalog. The Cluster YAML is an excerpt: replace imageCatalogRef: ... with your catalog reference and keep your existing instance and storage settings.

Usage

1. Add the pg-statviz extension image to your Cluster

Add the extension image to a complete Cluster definition:

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: cluster-pg-statviz
spec:
  imageCatalogRef: ...
  postgresql:
    extensions:
    - name: pg-statviz

2. Enable the extension in a database

Once the extension's files are available in the cluster, you can install it in a database in either of two ways:

Platform teams may make extension containers available across their clusters without installing every extension in every database. Install only the extensions a database uses; letting users enable them through SQL alongside the rest of their DDL schema management code can be a convenient approach.

For extensions that normally require superuser privileges, platform teams can use pgextwlist to allow non-superusers to install an administrator-approved selection of extensions.

3. Verify installation

Connect to the database with psql and run \dx to check the installed extensions.

Create a snapshot and inspect its timestamp:

SELECT pgstatviz.snapshot();
SELECT * FROM pgstatviz.snapshots ORDER BY snapshot_tstamp DESC;

Snapshots are stored in ordinary database tables and included in database backups. Define SQL-based retention for the expected snapshot volume. SELECT pgstatviz.delete_snapshots(); truncates the snapshot tables and is the packaged cleanup operation; it removes all snapshots. The image does not write report files.

Supported matrix and licenses

The image supports PostgreSQL 18 on Debian Bookworm and Trixie. The package's PostgreSQL-style license is included under /licenses/postgresql-18-statviz/. Renovate tracks the PGDG package.