The company I work for uses Google Cloud SQL to manage their SQL databases in production.
We\'re having performance issues and I thought it\'d be a good idea (among othe
April 3, 2019 UPDATE
It is now possible to log slow queries on Google Cloud SQL PostgreSQL instances, see https://cloud.google.com/sql/docs/release-notes#april_3_2019:
database_flags = [
{
name = "log_min_duration_statement"
value = "1000"
},
]
Once you enable log_min_duration_statement
, you can view the logs using Stackdriver logging. Select Cloud SQL Database
-> cloudsql.googleapis.com/postgres.log
and you will see the log like this.
[103402]: [9-1] db=cloudsqladmin,user=cloudsqladmin LOG: duration: 11.211 ms statement: [YOUR SQL HERE]
References:
log_min_duration_statement
): https://cloud.google.com/sql/docs/postgres/flags#postgres-l