diff --git a/sql/bloated_tables.sql b/sql/bloated_tables.sql index c3dfee9..dd707b9 100644 --- a/sql/bloated_tables.sql +++ b/sql/bloated_tables.sql @@ -33,11 +33,11 @@ with sum((1 - coalesce(ps.null_frac, 0)) * coalesce(ps.avg_width, 0)) as null_data_width, bool_or(pa.atttypid = 'pg_catalog.name'::regtype) or sum(case when pa.attnum > 0 then 1 else 0 end) <> count(ps.attname) as stats_not_available from - pg_attribute pa - inner join pg_class pc on pc.oid = pa.attrelid - inner join pg_namespace nsp on nsp.oid = pc.relnamespace - left join pg_stats ps on ps.schemaname = nsp.nspname and ps.tablename = pc.relname and ps.inherited = false and ps.attname = pa.attname - left join pg_class toast on toast.oid = pc.reltoastrelid + pg_catalog.pg_attribute pa + inner join pg_catalog.pg_class pc on pc.oid = pa.attrelid + inner join pg_catalog.pg_namespace nsp on nsp.oid = pc.relnamespace + left join pg_catalog.pg_stats ps on ps.schemaname = nsp.nspname and ps.tablename = pc.relname and ps.inherited = false and ps.attname = pa.attname + left join pg_catalog.pg_class toast on toast.oid = pc.reltoastrelid where not pa.attisdropped and pc.relkind = 'r' and diff --git a/sql/sequence_overflow.sql b/sql/sequence_overflow.sql index 51c1e34..56b4be2 100644 --- a/sql/sequence_overflow.sql +++ b/sql/sequence_overflow.sql @@ -22,9 +22,9 @@ with else null::bigint end as last_value from - pg_sequence s - inner join pg_class c on c.oid = s.seqrelid - left join pg_namespace nsp on nsp.oid = c.relnamespace + pg_catalog.pg_sequence s + inner join pg_catalog.pg_class c on c.oid = s.seqrelid + left join pg_catalog.pg_namespace nsp on nsp.oid = c.relnamespace where not pg_is_other_temp_schema(nsp.oid) and -- not temporary c.relkind = 'S'::char and -- sequence object