Table: gcp_sql_database_instance_metric_cpu_utilization - Query Google Cloud Platform SQL Database Instances using SQL
Google Cloud SQL is a fully-managed relational database service that makes it easy to set up, manage, and administer relational databases on Google Cloud Platform. It provides a way to run standard SQL queries on your data with ease. This service supports MySQL, PostgreSQL, and SQL Server.
Table Usage Guide
The gcp_sql_database_instance_metric_cpu_utilization
table provides insights into the CPU utilization of Google Cloud SQL Database Instances. As a database administrator or a cloud engineer, you can use this table to monitor CPU usage patterns and identify potential performance issues. This can be particularly useful in capacity planning and performance optimization tasks.
GCP Monitoring metrics provide data about the performance of your systems. The gcp_sql_database_instance_metric_cpu_utilization
table provides metric statistics at 5 minute intervals for the most recent 5 days.
Examples
Basic info
Determine the performance of your Google Cloud SQL database instances by analyzing CPU utilization over time. This query helps in identifying instances with irregular CPU usage patterns, which could indicate potential issues or areas for optimization.
select instance_id, minimum, maximum, average, sample_count, timestampfrom gcp_sql_database_instance_metric_cpu_utilizationorder by instance_id;
select instance_id, minimum, maximum, average, sample_count, timestampfrom gcp_sql_database_instance_metric_cpu_utilizationorder by instance_id;
Intervals averaging over 80%
Explore which instances in your Google Cloud SQL database have an average CPU utilization over 80%. This can help determine areas of potential overload or inefficiency, allowing you to better manage your resources.
select instance_id, round(minimum :: numeric, 2) as min_cpu, round(maximum :: numeric, 2) as max_cpu, round(average :: numeric, 2) as avg_cpu, sample_countfrom gcp_sql_database_instance_metric_cpu_utilizationwhere average > 80order by instance_id;
select instance_id, round(minimum, 2) as min_cpu, round(maximum, 2) as max_cpu, round(average, 2) as avg_cpu, sample_countfrom gcp_sql_database_instance_metric_cpu_utilizationwhere average > 80order by instance_id;
Intervals averaging < 1%
Explore instances of Google Cloud SQL databases where the average CPU utilization is less than 1%. This can help identify under-utilized resources, potentially leading to cost savings.
select instance_id, round(minimum :: numeric, 2) as min_cpu, round(maximum :: numeric, 2) as max_cpu, round(average :: numeric, 2) as avg_cpu, sample_countfrom gcp_sql_database_instance_metric_cpu_utilizationwhere average < 1order by instance_id;
select instance_id, round(minimum, 2) as min_cpu, round(maximum, 2) as max_cpu, round(average, 2) as avg_cpu, sample_countfrom gcp_sql_database_instance_metric_cpu_utilizationwhere average < 1order by instance_id;
Query examples
Schema for gcp_sql_database_instance_metric_cpu_utilization
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
average | double precision | The average of the metric values that correspond to the data point. | |
instance_id | text | The ID of the instance. | |
location | text | The GCP multi-region, region, or zone in which the resource is located. | |
maximum | double precision | The maximum metric value for the data point. | |
metadata | jsonb | The associated monitored resource metadata. | |
metric_kind | text | The metric type. | |
metric_labels | jsonb | The set of label values that uniquely identify this metric. | |
metric_type | text | The associated metric. A fully-specified metric used to identify the time series. | |
minimum | double precision | The minimum metric value for the data point. | |
project | text | =, !=, ~~, ~~*, !~~, !~~* | The GCP Project in which the resource is located. |
resource | jsonb | The associated monitored resource. | |
sample_count | double precision | The number of metric values that contributed to the aggregate value of this data point. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
sum | double precision | The sum of the metric values for the data point. | |
timestamp | timestamp with time zone | The time stamp used for the data point. | |
unit | text | The data points of this time series. When listing time series, points are returned in reverse time order.When creating a time series, this field must contain exactly one point and the point's type must be the same as the value type of the associated metric. If the associated metric's descriptor must be auto-created, then the value type of the descriptor is determined by the point's type, which must be BOOL, INT64, DOUBLE, or DISTRIBUTION. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- gcp
You can pass the configuration to the command with the --config
argument:
steampipe_export_gcp --config '<your_config>' gcp_sql_database_instance_metric_cpu_utilization