Skip to content

Instantly share code, notes, and snippets.

@nara-l
Created July 16, 2018 20:10
Show Gist options
  • Save nara-l/c8e97bc02f673af21e040987c6aa7b68 to your computer and use it in GitHub Desktop.
Save nara-l/c8e97bc02f673af21e040987c6aa7b68 to your computer and use it in GitHub Desktop.
A better and faster way to count distinct psycopg2 / python
SELECT COUNT(*) FROM (SELECT DISTINCT column_name FROM table_name) AS temp;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment