Skip to content

Instantly share code, notes, and snippets.

@enykeev
Last active April 20, 2022 07:39
Show Gist options
  • Save enykeev/19f145af03d92ec6b2b1df9c57fb1aa3 to your computer and use it in GitHub Desktop.
Save enykeev/19f145af03d92ec6b2b1df9c57fb1aa3 to your computer and use it in GitHub Desktop.
PG partitioning
-- Kafka-like partitioning
select abs(hashtext(id)) % 10 as partition, count(*) from events group by partition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment