I have enabled query insights on sql db instance, but still unable to get any data in the query insights dashboard.
DB version: PostgreSQL 14.4
Below errors are the only errors being logged in the db:
db=cloudsqladmin,user=cloudsqladmin STATEMENT: select count(*) from google_insights_aggregated_stats(); ERROR: function google_insights_aggregated_stats() does not exist at character 22"
Hi @Shravan_14 ,
Welcome to Google Cloud Community!
It appears that the error message âfunction google_insights_aggregated_stats() does not existâ suggests that the necessary extension for query insights is not installed or not enabled on your PostgreSQL 14.4 instance.
To resolve this issue, you should ensure that the âpg_stat_statementsâ extension is installed and enabled on your database. You can check if itâs already installed by running the command âdxâ in psql shell.
If itâs not installed, you can install it by running the following command in psql shell:
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
After that, you need to configure the pg_stat_statements by running the following query :
SELECT pg_stat_statements.track('all');
Once youâve done this, you should be able to see data in the query insights dashboard
Thank you!
Hi @christianpaula
Thanks for the reply.
pg_stat_statements extension is installed and pg_stat_statements.track flag is also set to all, but still there is no data in query insights dashboard.
Were you able to make it work somehow?
Hi,
the solution didnât work for me. I have a fresh postgres 14 migrated from aws. Iâm still getting:
db=cloudsqladmin,user=cloudsqladmin STATEMENT: select count(*) from google_insights_aggregated_stats(); ERROR: function google_insights_aggregated_stats() does not exist at character 22"
Hi,
this solution didtân work for me too. I got this error when I migrate the data from cloudsql instance X to cloudsql instance Y using DMS. I have also reenable the query insight, but it doestân work, still getting error âdb=cloudsqladmin,user=cloudsqladmin ERROR: function google_insights_aggregated_stats() does not exist at character 22â
Iâm seeing the same issue after migrating using DMS.
I also have this issue. All my DBâs have been migrated using DMS which seems consistent with what other people in this thread are seeing. Not all my databases have this issue. Some which have been migrated with DMS are fine, but others are not.
The error seems to be coming from the cloudsqladmin user running on the cloudsqladmin database, which users do not have access to. I imagine this is where the CREATE EXTENSION command would need to be run? If so, we canât do that.
Any other possible solution?
@christianpaula Is there a way we can extract these query insights result outside to bigquery or graffana ?