Postgres insights made easy
Supports PostgreSQL 9.2+
For Ruby, check out the pghero gem
A big thanks to Craig Kerstiens and Heroku for the initial queries 👏
View all running queries with:
SELECT * FROM pghero_running_queries;
Queries running for longer than five minutes
SELECT * FROM pghero_long_running_queries;
Queries can be killed by pid
with:
SELECT pghero_kill(123);
Kill all running queries with:
SELECT pghero_kill_all();
All usage
SELECT * FROM pghero_index_usage;
Missing indexes
SELECT * FROM pghero_missing_indexes;
Unused Indexes
SELECT * FROM pghero_unused_indexes;
Largest tables and indexes
SELECT * FROM pghero_relation_sizes;
SELECT pghero_index_hit_rate();
and
SELECT pghero_table_hit_rate();
Both should be above 99%.
Run this command from your shell:
curl https://raw.githubusercontent.com/ankane/pghero.sql/master/install.sql | psql db_name
or copy its contents into a SQL console.
curl https://raw.githubusercontent.com/ankane/pghero.sql/master/uninstall.sql | psql db_name
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