Database insights made easy
Supports PostgreSQL 9.2+
For pure SQL, check out PgHero.sql
A big thanks to Craig Kerstiens and Heroku for the initial queries 👏
Add this line to your application’s Gemfile:
gem 'pghero'
And mount the dashboard in your router.
mount PgHero::Engine, at: "pghero"
Be sure to secure the dashboard in production.
PgHero.running_queries
PgHero.long_running_queries
PgHero.index_usage
PgHero.missing_indexes
PgHero.unused_indexes
PgHero.unused_tables
PgHero.database_size
PgHero.relation_sizes
PgHero.index_hit_rate
PgHero.table_hit_rate
# kill queries
PgHero.kill(pid)
PgHero.kill_all
# query stats
PgHero.query_stats_enabled?
PgHero.enable_query_stats
PgHero.disable_query_stats
PgHero.reset_query_stats
PgHero.query_stats
PgHero.slow_queries
Set the following variables in your environment or an initializer.
ENV["PGHERO_USERNAME"] = "andrew"
ENV["PGHERO_PASSWORD"] = "secret"
authenticate :user, lambda {|user| user.admin? } do
mount PgHero::Engine, at: "pghero"
end
- show exactly which indexes to add
- more detailed explanations on dashboard
Know a bit about PostgreSQL? Suggestions are greatly appreciated.
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