You can't automatically generate a unique partition for each distinct varchar(128)
value.
You could hash partition the table. That would not guarantee that every partition had a single, unique user_id
value. It would ensure that all the rows with the same user_id
were in a single partition and would eliminate the need to do manual partition maintenance.
You could list partition the table. That would require, though, that you explicitly add a new partition when a new user_id
value is added.
If the user_id
values were strictly predictable, you could probably do something with an interval partitioning scheme on a virtual column. But that seems highly unlikely to be practical.
What is the business problem that you are trying to solve? Why is it necessary to have a single user_id
value in each partition? Why are you partitioning the table in the first place?