Redshift Observatory

System Table Tracker

System view information_schema.view_table_usage version 1.0.46806 / 2023-02-21

schema name column data type
information_schema view_table_usage table_catalog sql_identifier
information_schema view_table_usage table_name sql_identifier
information_schema view_table_usage table_schema sql_identifier
information_schema view_table_usage view_catalog sql_identifier
information_schema view_table_usage view_name sql_identifier
information_schema view_table_usage view_schema sql_identifier

View Text

SELECT DISTINCT CAST(current_database() AS information_schema.sql_identifier) AS view_catalog,
                CAST(nv.nspname AS information_schema.sql_identifier) AS view_schema,
                CAST(v.relname AS information_schema.sql_identifier) AS view_name,
                CAST(current_database() AS information_schema.sql_identifier) AS table_catalog,
                CAST(nt.nspname AS information_schema.sql_identifier) AS table_schema,
                CAST(t.relname AS information_schema.sql_identifier) AS table_name
FROM pg_user, pg_namespace AS nv, pg_class AS v, pg_depend AS dv, pg_depend AS dt, pg_class AS t, pg_namespace AS nt, pg_user AS u
WHERE nv.oid = v.relnamespace
  AND v.relkind = CAST('v' AS "char")
  AND v.oid = dv.refobjid
  AND dv.refclassid = CAST(CAST('pg_class' AS regclass) AS oid)
  AND dv.classid = CAST(CAST('pg_rewrite' AS regclass) AS oid)
  AND dv.deptype = CAST('i' AS "char")
  AND dv.objid = dt.objid
  AND dv.refobjid <> dt.refobjid
  AND dt.classid = CAST(CAST('pg_rewrite' AS regclass) AS oid)
  AND dt.refclassid = CAST(CAST('pg_class' AS regclass) AS oid)
  AND dt.refobjid = t.oid
  AND t.relnamespace = nt.oid
  AND (t.relkind = CAST('r' AS "char")
    OR t.relkind = CAST('v' AS "char"))
  AND t.relowner = u.usesysid
  AND u.usename = CAST("current_user"() AS name)


Home 3D Друк Blog Bring-Up Times Consultancy Cross-Region Benchmarks Email Forums IRC Mailing Lists Reddit Redshift Price Tracker Redshift Version Tracker Redshift Workbench System Table Tracker The Known Universe Twitter White Papers