The tables in the GP database generally set the distribution key, which, if not set, is usually the first field by default, so it is generally recommended that a single record be used as the distribution key, so that the records in the table are evenly distributed across each segment.
GP Database Distribution key Query method:
select c.schema_name, c.table_name, c.table_comment as "Chinese show", c.column_name as "Distribution Key", from ( select d.nspname as schema_name, c.relname as Table_name, obj _description (c.oid) as table_comment, a.attname as column_name from pg_class c left join pg_attribute a on a.Attrelid = c.oid join pg_ Namespace d on d.oid = c.relnamespace left join pg_inherits f on C.oid = f.inhrelid where a.attnum > 0 and f.inhrelid is null) c join (select a.attrnums[i.i] as a.attrnums, b.attname, a.localoid::regclass as localoid from gp_distribution_policy a, (Select generate_series (1,10) as generate _series) i (i), Pg_attribute b where a.attrnums[i.i] is not null and a.localoid = b.attrelid and a.attrnums[i.i] = B.attnum) t on c.column_name = t.attname and ((c.schema_name::text | | '. ':: text) | | a.table_name::text):: Regclass::oid = t.localoid::oid order by c.schema_name, c.table_name, c.column_name;
GP Database Distribution key Query