I am creating user management database schema. I am using Postgresql as database. Following is my approach. Please suggest if there is any performance issue if I use this structure.
Requirement:
- Expecting around millions of users in future.
- I have to use unique user id on other systems also, may be on MongoDB, redis etc.
Approach:
- I am using pseudo_encrypt() as unique user_id (BIGINT or BIGSERIAL), so that no one can guess other ids. For example: 3898573529235304961
- Using user_id as foreign key in another table. I am not using primary key of user table as foreign key.
Any suggestions?
- Use of unique key as foreign key everywhere in other tables, am I doing it correct?
- Any performance issue during CRUD operations & with complex joins?
- Use of unique key in any other database is correct way? (in case of distributed environment)
