Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7526461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:50:12+00:00 2026-05-30T03:50:12+00:00

I am thinking about a schema design that involves having users and user roles,

  • 0

I am thinking about a schema design that involves having users and user roles, but I am not sure what would be the better route.

Option 1

Create three tables, one with the user information, one with the role information, and one with th user role relation.

users {
    u_id,
    etc
}

roles {
   r_id,
   r_name,
   etc
}

user_roles {
   u_idm
   r_id
}

Option 2

Create two tables, one with the user information, and the other with role, role info,and relation info.

users {
    u_id,
    etc
}

roles {
   r_id,
   u_id,
   r_name,
   etc
}

Option 1 is more robust but requires an extra join. Option 2 will require an extra primary key but will only be one join. If I ever change the role name, it would take longer to update with option, but I don’t forsee updates being frequent.

For a scalable solution, which would be better? What other insights in my missing? This is for a mysql and postgresql solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:50:14+00:00Added an answer on May 30, 2026 at 3:50 am

    Option 1.
    What good is a role if only one user can have each role?
    If you have 100 registered users there would be 100 duplicate definitions for “registered user”.

    The more “etc” there is the bigger your db will get.

    Having that many duplicates will slow down your database and in the end things will be a lot slower even if you have one join less.

    If you run lots of role based querys and relly eel like you need a database like the one from option two you can still create a view and have the database cache it, but I doubt that this will do you any good.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Fairly new to database schema (plan to use SQLite). Having said that, I'm thinking
I'm thinking about building a Mac (maybe later Windows) application that would expose its
I am thinking about providing a version of say, the database schema and the
Thinking about a Windows-hosted build process that will periodically drop files to disk to
Thinking about avoiding code replication, I got a question that catches me every time
We are thinking about to create new schema with its own 3 tables which
I'm not quite sure stackoverflow is a place for such a general question, but
I am thinking about rewriting a schema with lots of standalone complex types in
Again I would like to get your opinion about a design issue. I have
I'm thinking about a problem which has some similarity with perfect forwarding, but where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.