This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select DISTINCT c.table_catalog, c.table_schema, c.table_name, c.column_name, c.data_type, s1.seq_scan, | |
split_part(idx.idx_column, ',', 1) as idx_column, | |
log(case when s1.seq_scan > 0 then s1.seq_scan else 1 end) as seq_ratio_log, | |
case when t.table_type != 'VIEW' THEN 1 ELSE 0 END AS is_table | |
from | |
information_schema.columns as c left join | |
information_schema.tables as t on c.table_name = t.table_name and | |
c.table_schema = t.table_schema and c.table_catalog = t.table_catalog left join | |
pg_catalog.pg_stat_all_tables as s1 on c.table_schema = s1.schemaname and | |
c.table_name = s1.relname left join |