Skip to content

Instantly share code, notes, and snippets.

@begriffs
Created July 19, 2016 22:19
Show Gist options
  • Select an option

  • Save begriffs/ebbb717971e6791c325826650a48180c to your computer and use it in GitHub Desktop.

Select an option

Save begriffs/ebbb717971e6791c325826650a48180c to your computer and use it in GitHub Desktop.
Count distinct on non-distribution column

Problem: SELECT DISTINCT (non-distribution column)

Citus supports SELECT DISTINCT col but only when col is the shard distribution column. If it is not, use GROUP BY as a simple workaround:

select col from table group by col;
@lithp
Copy link
Copy Markdown

lithp commented Jul 21, 2016

This query doesn't count distinct though. Does it work if we wrap it in a query that counts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment