View the distribution key of a table

  • Run the following command on the psql CLI client to view the distribution key of a table:
    \d tblname
  • Execute the following SQL statement to view the distribution key of a table:
    SELECT attname FROM pg_attribute WHERE attrelid='schemaname.tblname'::regclass and attnum in (SELECT unnest(attrnums) FROM pg_catalog.gp_distribution_policy t WHERE localoid='schemaname.tblname'::regclass);
    Note
    • The schemaname parameter specifies the schema of the table.
    • The tblname parameter specifies the name of the table.

View the partitions of a table

  • Run the following command on the psql CLI client to view the partitions of a table:
    \d+ tblname
  • Execute the following SQL statement to view the partitions of a table:
    SELECT pg_get_partition_def('schemaname.tblname'::regclass,true);
    • The schemaname parameter specifies the schema of the table.
    • The tblname parameter specifies the name of the table.