Cloud SQL Postgres log_min_duration_statement

250 views
Skip to first unread message

Jesse Ezell

unread,
Mar 20, 2018, 9:04:31 AM3/20/18
to Google Cloud SQL discuss
What is the expected way to log slow queries with PG + Cloud SQL? Attempting to modify the database flag log_min_duration_statement via alter database results in an error.

Taher (Cloud Platform Support)

unread,
Mar 20, 2018, 7:52:35 PM3/20/18
to google-cloud...@googlegroups.com

Hello Jesse,


Unfortunately, on CloudSQL for PostgreSQL, there is no slow query log supported flag.  Moreover, I believe the flag log_min_duration_statement requires SUPER privilege to change the setting which is not allowed in CloudSQL.


However, there is an open feature request for allowing slow query logging support for PostgreSQL. I would suggest you comment on the feature request and star it to attract more attention to it.


That said, I would also suggest going over our performance documentation for PostgreSQL instances which might help you resolve the slow query issue. If there are specific queries which are causing the performance issue, you can run EXPLAIN on those slow queries to find out where to add indexes.


Hope this helps.

Santiago Fontana

unread,
May 26, 2020, 10:47:24 AM5/26/20
to Google Cloud SQL discuss
Hello,

Now the flag "log_min_duration_statement" is available, according to this: https://cloud.google.com/sql/docs/postgres/flags

Also, thanks Taher for the link to the Feature Request, I starred it!

Best Regards,
Reply all
Reply to author
Forward
0 new messages