Skip to content

Instantly share code, notes, and snippets.

@hadrienblanc
Created July 4, 2019 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadrienblanc/7c69fee5115711f09fd4e2fda39f68db to your computer and use it in GitHub Desktop.
Save hadrienblanc/7c69fee5115711f09fd4e2fda39f68db to your computer and use it in GitHub Desktop.

ORDER BY NULL

Explicitly ORDER BY After GROUP BY By default, the database sorts all 'GROUP BY col1, col2, ...' queries as if you specified 'ORDER BY col1, col2, ...' in the query as well. If a query includes a GROUP BY clause but you want to avoid the overhead of sorting the result, you can suppress sorting by specifying 'ORDER BY NULL'.

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