Skip to content

Instantly share code, notes, and snippets.

@seahrh
Created November 5, 2020 08:52
Show Gist options
  • Save seahrh/c9016bb0418c55b92b2cc4ede001b1b6 to your computer and use it in GitHub Desktop.
Save seahrh/c9016bb0418c55b92b2cc4ede001b1b6 to your computer and use it in GitHub Desktop.
redshift show sortkey columns
-- see https://docs.aws.amazon.com/redshift/latest/dg/r_PG_TABLE_DEF.html
select "column", type, encoding, distkey, sortkey
from pg_table_def where schemaname='public' and tablename='mytable' and sortkey!=0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment