Monitoring and managing sessions and queries in the Command Center
Greenplum® Command Center offers the following features:
- Viewing information about sessions and queries.
- Viewing the resource consumption history for completed queries.
- Aborting the current session.
- Terminating the current query.
Check out these use cases for how and when you can use the Command Center.
For more information about the statistics you can get using the Command Center, see Greenplum® Command Center.
Note
The Command Center is available in clusters with Greenplum® version 6.25 or higher.
Viewing information about sessions and queries
You can view a list of sessions and queries with details on them. For each session, you can view its history and queries made within it. For each query, you can view its execution plan and a JSON file with details.
To view information about sessions and queries:
-
Navigate to the folder dashboard
and select Yandex MPP Analytics for PostgreSQL. -
Click the cluster name and navigate to the
Command center tab. -
Select what you want to view and navigate to relevant tab:
- Current state for the current sessions and queries.
- State history for sessions or queries at a given time point in the past.
-
Navigate to the Sessions or Queries section. In the State history tab, these are under the chart.
-
To filter a session or query list, click
Filters and select the relevant parameters. -
To view details for:
- Sessions: Click the session name.
- Queries: Click the key of the query you are running.
For session and query parameters, see Greenplum® Command Center parameters.
Viewing the resource consumption history for completed queries
The resource consumption history includes a variety of system metrics. These show how a Greenplum® cluster was consuming resources to process queries at different time points. You can also view a list of completed queries. Using this information, you can manage your cluster hosts' CPU and memory in such a way so as to process queries more effectively.
To view the resource consumption history for completed queries:
-
Navigate to the folder dashboard
and select Yandex MPP Analytics for PostgreSQL. -
Click the cluster name and navigate to
Command center → Usage history. -
Select the consumption metric you need:
- CPU Time: Time it took the CPU resources to process the queries, in seconds.
- Peak memory: Maximum memory the cluster used to process a query during its lifetime.
- Disk R: Memory used for data reads, in bytes.
- Disk W: Memory used for data writes to the DB, in bytes.
- Spill: Additional memory used for query execution.
- Total time: Total memory used for query processing, in bytes.
Once you select the consumption metric, you will see a chart with details and a list of queries. The chart will show the metric value, the user who ran the query, and the query execution time.
-
To filter the results, click
Filters and select the relevant parameters.
Aborting the current session
To free up resources for sessions, you can abort a session, e.g., one that is Idle. To do this:
-
Navigate to the folder dashboard
and select Yandex MPP Analytics for PostgreSQL. -
Click the cluster name and navigate to the
Command center tab. -
In Current state → Sessions, click
in the relevant line and select Terminate session.If you see Terminate query, select it and stop the query.
-
Confirm stopping the session.
Terminating the current query
To free up resources for queries, you can terminate a query, for example, an Idle query within an idle session. To do this:
- Navigate to the folder dashboard
and select Yandex MPP Analytics for PostgreSQL. - Click the cluster name and navigate to the
Command center tab. - In Current state → Queries, click
in the relevant line and select Terminate query. - Confirm terminating the query.
Examples
Identifying a current session that is consuming excessive resources
There might be cases where a user is no longer working with the database but failed to terminate their session. In such cases, a session remains idle tying up cluster resources and degrading its performance. To identify and terminate such a session, do the following:
- Navigate to the folder dashboard
and select Yandex MPP Analytics for PostgreSQL. - Click the cluster name and navigate to
Command center → Current state. - Filter the sessions by Start time.
- Find the longest-lasting session with an
Idlestatus. - Click its number. This will open a page with detailed info about this session.
- Check when the last query was submitted in the Session info field under Query start time. If it has been a while, the user is most likely no longer using the database but has not closed the session. You can terminate this session.
- In the top-right corner, click Terminate session.
- Confirm stopping the session.
Identifying CPU-intensive queries
At times, you might observe unusual spikes in CPU consumption. To determine which queries caused the spikes, do the following:
-
Find out when the spike occurred:
-
Navigate to the folder dashboard
and select Yandex MPP Analytics for PostgreSQL. -
Click the cluster name and navigate to
Command center → State history. -
Set the CPU usage filter.
-
Use the chart to find out the peak CPU consumption time.
Hover over the highest point on the chart curve. You will see a pop-up displaying the cluster state details for the selected time point. The window will include the time point when the spike occurred.
-
-
Identify the CPU-intensive queries:
- Navigate to the Usage history tab.
- Set the time range based on the state history data.
- Group the queries by user, database, and query ID. This will group similar queries together.
- Filter the query groups by CPU time.
- Open the group with the highest CPU time value.
- Check the details of each query and adjust them if needed. You can also terminate a query that is still running.
Greenplum® and Greenplum Database® are registered trademarks or trademarks of Broadcom Inc. in the United States and/or other countries.