Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

PgHero.sql

Note: This has been replaced with PgHero.

Postgres insights made easy

Supports PostgreSQL 9.4+

A big thanks to Craig Kerstiens and Heroku for the initial queries 👏

Features

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();

Index Usage

All usage

SELECT * FROM pghero_index_usage;

Missing indexes

SELECT * FROM pghero_missing_indexes;

Unused Indexes

SELECT * FROM pghero_unused_indexes;

Space

Largest tables and indexes

SELECT * FROM pghero_relation_sizes;

Cache Hit Ratio

SELECT pghero_index_hit_rate();

and

SELECT pghero_table_hit_rate();

Both should be above 99%.

Install

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.

Uninstall

curl https://raw.githubusercontent.com/ankane/pghero.sql/master/uninstall.sql | psql db_name

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

About

Postgres insights made easy

Resources

License

Releases

No releases published

Packages

No packages published