Current Activity for PostgreSQL in Redgate Monitor
Current Activity for PostgreSQL in Redgate Monitor provides a real-time view of queries currently running on your PostgreSQL instances. It will allow you to identify quickly any queries that are currently causing blocking and resource contention issues on an instance.
Support for Current Activity monitoring in PostgreSQL, in Redgate Monitor version 14.0.10 and later, is another important step in our drive to achieve feature parity with SQL Server, where the feature has been available since v12.
Reviewing historical and current activity on a monitored server
Redgate Monitor’s data samplers collect a wide range of metric and alert data, which will include resource use (memory, CPU, I/O), user activity (connections, requests, locks, latches), query details, execution statistics, wait statistics and a lot more.
It samples this data at preset intervals, stores and analyses it continuously, and uses it to provide a detailed graphical overview for each monitored server, showing the history of resource usage, server and user activity and alerts. To view it, simply click on a PostgreSQL server in the global dashboard to go to the History tab of its Server Overview page.
Sometimes, however, you just need to focus in on what is running on the server, right now. This is where the Current activity tab comes in:
Using the Current activity tab
Switch to the Current activity view and you should immediately see a table listing all the queries currently in progress on the server. This data is taken from the pg_stat_activity
view in PostgreSQL. It shows all the current connections to the server, and the associated queries that are being run:
Click the refresh button to update the data displayed on the table. The “play” icon in the top right will toggle sampling on and off. Displayed just above this is the last update time.
If you expand a given row, in the table of active queries, you’ll see the query text in full. You can use the Copy query text button to copy the query to your clipboard.
You can also filter the results by typing in the search boxes, or by using the pre-populated checkboxes, and sort the results by clicking on the column headers.
Why is this information useful?
You can use the information in the Current Activity tab in several ways to manage and optimize the performance of your databases. For example, you can:
- Identify long running queries that may be causing performance issues.
- Investigate blocking and locking issues by identifying which queries are waiting for locks or other resources.
- Monitor the number of active and idle connections and ensure they are within your normal, acceptable limits.
- Investigate which applications are connected to the database and what queries they are executing.
What’s next?
We want to achieve feature parity between our SQL Server and PostgreSQL implementations of Current Activity. We are working on adding more details for each row that we believe will be helpful, including displaying the query plan for each query, when available.
As always with our new features, we are actively looking for feedback. Please do let us know what you think and if you have any ideas for improvements. You can leave feedback by clicking the message icon in the top right of the Redgate Monitor dashboard.
Tools in this post
Redgate Monitor
Real-time SQL Server and PostgreSQL performance monitoring, with alerts and diagnostics