algorithm - Distribution of user accounts to N tables -
There are millions of user accounts, and I want to distribute my data in N tables (user_1, user_2, ..., User_n) The user account of a database has 3 ~ 8 characters, therefore, I need a function that returns the table suffix like
int getTableSuffix (string user account); The result is an equal distribution for N 1
Do you know any cheaper hash algorithms for this job?
You can first assume ascii values of 1-3 characters and return those numbers to their number Can find a product of
Alternatively, you can actually use the characters as your table prefix, as such. Users_AA, Users_AB, etc.
However, what database are you using for this data? In most modern databases, there should be no need to create multiple tables to store the same data. Even with millions of records, good indexing on your table should be more than enough to solve any performance issues.
Comments
Post a Comment