Table: gcp_sql_database_instance_metric_connections_daily - Query GCP SQL Database Instance Metrics using SQL
Google Cloud SQL is a fully-managed database service that makes it easy to set up, maintain, manage, and administer your relational databases on Google Cloud Platform. You can use Cloud SQL with MySQL, PostgreSQL, or SQL Server. The service provides detailed metrics on database instances, including connection metrics, to help monitor the health and performance of your databases.
Table Usage Guide
The gcp_sql_database_instance_metric_connections_daily
table provides insights into daily connection metrics for Google Cloud SQL instances. As a database administrator, you can explore instance-specific details through this table, including the number of established connections, aborted connections, and failed connection attempts. Use it to monitor database connection patterns, identify potential anomalies, and optimize your database performance.
GCP Monitoring metrics provide data about the performance of your systems. The gcp_sql_database_instance_metric_connections_daily
table provides metric statistics at 24 hour intervals for the past year.
Examples
Basic info
Analyze the daily connection metrics of Google Cloud SQL database instances to gain insights into their usage patterns. This could be useful for capacity planning and performance optimization.
select instance_id, minimum, maximum, average, sample_countfrom gcp_sql_database_instance_metric_connections_dailyorder by instance_id;
select instance_id, minimum, maximum, average, sample_countfrom gcp_sql_database_instance_metric_connections_dailyorder by instance_id;
Intervals averaging over 100 connections
Explore which Google Cloud SQL database instances have an average daily connection count exceeding 100. This is useful for identifying potentially over-utilized instances that may require capacity scaling or performance optimization.
select instance_id, round(minimum :: numeric, 2) as min_connection, round(maximum :: numeric, 2) as max_connection, round(average :: numeric, 2) as avg_connection, sample_countfrom gcp_sql_database_instance_metric_connections_dailywhere average > 100order by instance_id;
select instance_id, round(minimum, 2) as min_connection, round(maximum, 2) as max_connection, round(average, 2) as avg_connection, sample_countfrom gcp_sql_database_instance_metric_connections_dailywhere average > 100order by instance_id;
Intervals averaging fewer than 10 connections
Analyze the settings to understand the performance of your Google Cloud SQL Database instances, specifically those that average fewer than 10 connections daily. This can be beneficial in identifying underutilized instances and optimizing resource allocation.
select instance_id, round(minimum :: numeric, 2) as min_connection, round(maximum :: numeric, 2) as max_connection, round(average :: numeric, 2) as avg_connection, sample_countfrom gcp_sql_database_instance_metric_connections_dailywhere average < 10order by instance_id;
select instance_id, round(minimum, 2) as min_connection, round(maximum, 2) as max_connection, round(average, 2) as avg_connection, sample_countfrom gcp_sql_database_instance_metric_connections_dailywhere average < 10order by instance_id;
Schema for gcp_sql_database_instance_metric_connections_daily
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_connections_daily