WITH tables AS (
SELECT DISTINCT table_name,
table_schema,
column_name,
ordinal_position AS pos
FROM svv_columns
WHERE table_schema NOT IN (‘pg_internal’,‘pg_catalog’,‘information_schema’)
)
SELECT table_name, table_schema, column_name
FROM tables
WHERE
HAS_SCHEMA_PRIVILEGE(table_schema, ‘USAGE’) AND
(
table_schema IN (SELECT schemaname FROM SVV_EXTERNAL_SCHEMAS) OR
HAS_TABLE_PRIV
above query from redash is causing high cpu in our redshift cluster,is it because of some particular tab/refresh being hit multiple times?
any insights would be helpful