greenplum 6 变化很大,以前很多查询语句都不能用。这个也就用一下,方便查询。
select n.nspname AS "模式名",c.relname AS "表名",case when p.policytype='p' then '分区表' when p.policytype='r' then '复制分布' end "分布策略", pg_get_table_distributedby(c.oid) "分布键" ,c.reloptions "压缩类型"
from pg_class c
left join gp_distribution_policy p on c.oid=p.localoid
left join pg_namespace n on c.relnamespace=n.oid
where c.relname in ('$tablename','$tablename')
and n.nspname='$schemaname'