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 8771195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:43:27+00:00 2026-06-13T17:43:27+00:00

I am developing a system that will eventually have millions of users. Each user

  • 0

I am developing a system that will eventually have millions of users. Each user of the system may have acces to different ‘tabs’ in the system. I am tracking this with a table called usertabs. There are two ways to handle this.

Way 1: A single row for each user containing userid and tab1-tab10 as int columns.

The advantage of this system is that the query to get a single row by userid is very fast while the disadvantage is that the ’empty’ columns take up space. Another disadvantage is that when I needed to add a new tab, I would have to re-org the entire table which could be tedious if there are millions of records. But this wouldn’t happen very often.

Way 2: A single row contains userid and tabid and that is all. There would be up to 10 rows per user.

The advantage of this system is easy sharding or other mechanism for optimized storage and no wasted space. Rows only exist when necessary. The disadvantage is up to 10 rows must be read every time I access a record. If these rows are scattered, they may be slower to access or maybe faster, depending on how they were stored?

My programmer side is leaning towards Way 1 while my big data side is leaning towards Way 2.

Which would you choose? Why?

  • 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-06-13T17:43:29+00:00Added an answer on June 13, 2026 at 5:43 pm

    Premature optimization, and all that…

    Option 1 may seem “easier”, but you’ve already identified the major downside – extensibility is a huge pain.

    I also really doubt that it would be faster than option 2 – databases are pretty much designed specifically to find related bits of data, and finding 10 records rather than 1 record is almost certainly not going to make a difference you can measure.

    “Scattered” records don’t really matter, the database uses indices to be able to retrieve data really quickly, regardless of their physical location.

    This does, of course, depend on using indices for foreign keys, as @Barmar comments.

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

Sidebar

Related Questions

I'm developing an add on to a system I have that will allow my
I am developing a system that will have a database backend. I am intending
I'm developing online examination system in php-mysql. That exam will consist of multiple-choice questions;
I'm developing a documents system that, each time that a new one is created,
I'm developing a system, and I have build a code generator that emits a
I will be developing a system that will involve a data acquisition server where
I am developing a system that will receive a XML (XmlDocument) via webservice. I
I am developing a system that will provide many services, say, S1 , S2
We are developing a service layer for a new system that will handle all
If Python, if you are developing a system service that communicates with user applications

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.