I have been actively using PostgreSQL for the last 7 years. As with many databases engines, PostgreSQL provides us with many capabilities when it comes to helping developers identify slow performing queries. This article focuses on several useful (primarily administrative queries) for PostgreSQL which may be helpful in debugging you database performance issues. Queries Show Running Queries Often times it is useful to see which queries are running and how long they have been running from. The below is a sample query to find 'active' queries and information about them. SELECT pid, client_addr, query_start, age(query_start, clock_timestamp()), usename, query, state, wait_event_type, -- Only available in >9.6 wait_event -- Only available in >9.6 FROM pg_stat_activity WHERE query != ' ' AND query NOT ILIKE '%pg_stat_activity%' AND state = 'active' ORDER BY query_start desc; Particularly useful attribute ...
Keeping me and perhaps you up to date with focus on technology