Hari Das
Hari Das

Reputation: 10914

Why Google Cloud SQL statistics shows usage even if I am not using it?

I am not using my Cloud SQL since last 7 days and there is no query I am firing. Then why this graph shows I am making 10 queries per second. What does this graph signify ?

enter image description here

Upvotes: 2

Views: 252

Answers (1)

Antonio Ramirez
Antonio Ramirez

Reputation: 1068

That graph signifies the number of statements executed by the server. This variable includes statements executed within stored programs.

To have a wider vision of what queries you Cloud SQL server is executing you can: 1. Enable Cloud SQL flag general_log=ON and log_output=FILE[1] 2. Go to [2], select your Cloud SQL instance and All logs=cloudsql.googleapis.com/mysql-general.log

You will see in the stackdriver logs the queries your server is executing behind. You can further look up these queries in the mysql reference manual.

If you have Cloud Audit logs enabled then the latter could be the reason why you are seeing these results in the graph. To disable Audits logs, you need to go to[3] and uncheck the Cloud SQL row.

Important: 1. When you set, remove, or modify a flag for a database instance, the database might be restarted. The flag value is then persisted for the instance until you remove it. If the instance is the source of a replica, the replica will also restart to align with the current configuration of the instance[1].

  1. After looking into the cloudsql.googleapis.com/mysql-general.log, you may want to disable general_log and output_file to stop further charges due to the log size. I would recommend you also visit the tips for general log flags[4].

[1] https://cloud.google.com/sql/docs/mysql/flags#config

[2] https://console.cloud.google.com/logs/viewer

[3] https://console.cloud.google.com/iam-admin/audit

[4] https://cloud.google.com/sql/docs/mysql/flags#tips

Upvotes: 2

Related Questions