All Projects → lfittl → pg_qtop

lfittl / pg_qtop

Licence: BSD-3-Clause license
PostgreSQL query monitor, shows the top queries running

Programming Languages

ruby
36898 projects - #4 most used programming language

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].