I am creating a database schema for user management in PostgreSQL. As, it supports array, so I am trying with three approaches.
Which one is best, querying with joins or getting/setting role data with array?
Considering large user base in near future.
Approach 1:
User table
id
user_name
Role table
id
role_name
RoleUser table
role_id
user_id
Approach 2
User table
id
user_name
[integer array of role id]
Role
id
role_name
Approach 3
User table
id
user_name
[string array of role key]
Role
id
role_name
role_key