Project

pg_qtop

0.0
No commit activity in last 3 years
No release in over 3 years
Shows the top queries running on your server using pg_stat_statements
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0

Runtime

 Project Readme

pg_qtop

Simple ruby program that shows you queries running using pg_stat_statements.

This is different from the pg_stat_activity view in that it shows you all the queries that have run since the program was started, not just the queries running at the moment when you're looking at it.

Installation

gem install pg_qtop

Usage

pg_qtop -d DATABASE -h HOSTNAME -p PORT -U USER

In order to filter queries on a certain table, specify it with -t:

pg_qtop -d DATABASE -t TABLE

You can also filter the kind of statements that are shown with -s, e.g.:

pg_qtop -d DATABASE -t TABLE -s insert

Sample Output

AVG     | CALLS | HIT RATE      | QUERY
--------------------------------------------------------------------------------
50.1ms  | 20    | 45.0          | SELECT * FROM databases;
2.1ms   | 12    | 97.0          | SELECT * FROM users;
0.0ms   | 1     | -             | SELECT * FROM query_snapshots;

The view auto-refreshes every second.

Authors

License

pg_qtop is licensed under the 3-clause BSD license, see LICENSE file for details.