Skip to content

Instantly share code, notes, and snippets.

@ORESoftware
Created January 4, 2021 00:40
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 ORESoftware/fcb6f2eb53afe91e052d6c779b35456d to your computer and use it in GitHub Desktop.
Save ORESoftware/fcb6f2eb53afe91e052d6c779b35456d to your computer and use it in GitHub Desktop.
how to partition on user_id, but use modulus, in order to avoid too many partitions?

how do I create partition based on modulus of an id? something like this:

create table my_table(id bigint)
partition by value (modulus(id,1000));

create table my_table_0
partition of my_table
for values in (0);

--- from 0-999

create table my_table_999
partition of my_table
for values in (999);

...how can I do this?

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