why i got these queries on log every 1-2 seconds ?

32 views
Skip to first unread message

Hong Cheng

unread,
May 13, 2021, 9:46:21 AM5/13/21
to Google Cloud SQL discuss
WITH non_cloudsql_users AS (
SELECT * FROM pg_catalog.pg_user WHERE usename NOT LIKE 'cloudsql%'),
iam_roles AS (
SELECT pg_catalog.pg_has_role(usename, 'cloudsqliamuser', 'member') AS is_iam_user,
pg_catalog.pg_has_role(usename, 'cloudsqliamserviceaccount', 'member') AS is_svc_acct
FROM non_cloudsql_users)
SELECT pg_catalog.SUM(is_iam_user::int),
pg_catalog.SUM(is_svc_acct::int),
pg_catalog.SUM((NOT(is_iam_user OR is_svc_acct))::int),
current_timestamp
FROM iam_roles

Why this happen ? how to stop it ?

Thanks
hong

David (Cloud Platform Support)

unread,
May 13, 2021, 7:15:28 PM5/13/21
to Google Cloud SQL discuss

Hello,

Do you have pg_stat_statements enabled? Seems like something it would be logged if you do. 

Hong Cheng

unread,
May 14, 2021, 1:37:17 PM5/14/21
to google-cloud...@googlegroups.com
no, i think because there are too many roles. 
Any suggestions for max roles for best practices?

Thanks
hong


--
You received this message because you are subscribed to a topic in the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-cloud-sql-discuss/GDzR8uilu2c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-cloud-sql-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/da2919ec-6c99-46f7-a830-b8cd684fd17dn%40googlegroups.com.

wushawn

unread,
May 15, 2021, 8:07:07 PM5/15/21
to Google Cloud SQL discuss
Can you double confirm the service account you use  ? it seems something related to the IAM not set properly. 

Hong Cheng

unread,
May 17, 2021, 9:17:47 AM5/17/21
to Google Cloud SQL discuss

hi wushawn,

where can i find my service account ?

Thanks
hong

wokmou

unread,
May 18, 2021, 5:07:46 PM5/18/21
to Google Cloud SQL discuss
Hi,

You can find your service account on the IAM & Admin > IAM page. Depending on if you create your own service account or used the default the may look like this[1]

Reply all
Reply to author
Forward
0 new messages