I have the following table with HUGE amount of data, this is why I want to split or partition it. The problem is I want to partition by a column that is no primary key: project_id. In my case there will be MAXIMUM 2 or 3 different project ids...
- id (PRIMARY KEY, AUTO INCREMENT)
- project_id (INT)
- username (UNIQUE)
- username_md5 (UNIQUE)
(- ... more but irrelevant columns)
As you can see I have 3 columns that I need to guarantee to be UNIQUE (id, username, username_md5). Now, I would like to do a RANGE partitioning on the project_id column. The only solution that I came up with is making an ugly 4-Column PRIMARY KEY for all those columns (Partitioning requires that all columns in the partitioning expression must be part of every unique key).
Now, I'm wondering
A) is a 4-column primary key just fine and usable?
B) is there a better solution for my partitioning?
C) otherwise I would do it manually by creating a "dynamic" table for each project_id that I have, might this be the easiest solution?