A performance dashboard for Postgres
🍊 Battle-tested at Instacart
This is a fork of ankane/pghero that normalizes query text out of pghero_query_stats into a pghero_queries lookup table.
Upstream stores the full query text on every capture row. With multi-database installs and a 5-minute capture interval that adds up fast — on the install this fork was developed against, 6.17 M stats rows held only 6.6 K distinct queries, with the same text repeated ~692 times each. pghero_query_stats was 2.4 GB; ~1.8 GB of it was duplicated text. After this patch and a VACUUM FULL, the same data fits in 785 MB plus an 8 MB lookup table (67% reduction).
The change implements ankane/pghero#381, which @ankane acknowledged and added to the roadmap in 2021 but hasn't shipped yet. This fork carries it forward against the current codebase. See the CHANGELOG entry for the rollout (Stage 1 additive migration → rake pghero:backfill_query_ids → Stage 3 drops the legacy columns). New installs go straight to the normalized schema; existing installs upgrade in place with the pghero:normalize_queries generator.
A docker/ directory ships a Dockerfile that layers the patch onto ankane/pghero:v3.8.0 and bakes both migrations so a container restart applies them.
Everything below this section is upstream documentation and applies unchanged.
PgHero is available as a Docker image, Linux package, and Rails engine.
Select your preferred method of installation to get started.
- Dexter - The automatic indexer for Postgres
- PgBouncerHero - A dashboard for PgBouncer
- pgsync - Sync Postgres data between databases
- pgslice - Postgres partitioning as easy as pie
A big thanks to Craig Kerstiens and Heroku for the initial queries and Bootswatch for the theme.
View the changelog
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features