-
Notifications
You must be signed in to change notification settings - Fork 20
How it works
Оnce a second PASH-Viewer make a request to the database view pg_stat_activity:
SELECT current_timestamp,
datname, pid, usesysid, usename, application_name, backend_type,
coalesce(client_hostname, client_addr::text, 'localhost') as client_hostname,
wait_event_type, wait_event, query, query_start,
1000 * EXTRACT(EPOCH FROM (clock_timestamp()-query_start)) as duration
from pg_stat_activity
where state = 'active' and pid != pg_backend_pid();Each 15 second PASH-Viewer averages data and displays it on the graph, grouping by WAIT_EVENT_TYPE (like WAIT_CLASS in Oracle). You can switch to the Details tab and inspect wait events of the specific type.
You can select a period on the graph and view the Top SQLs of that period. For this to work, PASH-Viewer parse query text and normalize it - replace literals with $1, $2 etc... It allows to group the same queries with different variables into the single SQL_ID.
If you click on some SQL_ID in the Top SQL - you can view its text and execution plan. About working with plans read: https://github.com/dbacvetkov/PASH-Viewer/wiki/How-to-catch-execution-plans-for-queries