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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:29:47+00:00 2026-05-11T01:29:47+00:00

I’m in the process of working on a user profile system for a website

  • 0

I’m in the process of working on a user profile system for a website and am pondering what would be a better (scalable) approach to take. I’ve come up with two solutions and am looking for either input or perhaps pointers to something I might have missed.

The following create table statements are not meant to be executable but are merely there to give an idea of the layout of the tables involved.

My initial thought was something like this:

CREATE TABLE user(     id INT UNSIGNED NOT NULL AUTO_INCREMENT,      user_email VARCHAR(320),      user_joined DATATIME,     user_last_seen DATATIME,      user_name_first VARCHAR,     user_name_last VARCHAR,      user_name_alias VARCHAR,      user_location_country VARCHAR,     user_location_region VARCHAR,     user_location_city VARCHAR      # ... ); 

Obviously this isn’t very scalable at all and adding additional properties i annoying. The one advantage is I can quickly search for users matching a specific set of properties. I’ve done a bit of looking around and this is a pretty common approach (e.g. WordPress).

My second approach (the one I’m currently playing around with) is much more scalable but I’m a little concerned about performance:

CREATE TABLE user(     id INT UNSIGNED NOT NULL AUTO_INCREMENT,      user_email VARCHAR(320) );  CREATE TABLE user_profile(     user_id INT UNSIGNED NOT NULL,      visibility ENUM('PRIVATE', 'PUBLIC'),      name VARCHAR,     value VARCHAR ); 

Using this approach every use has a set of key value pairs associated with it which makes adding additional properties trivial as well as loading the users profile when they login. However I lose all the type information I had in the first approach (e.g. DATETIME is now stored as a formatted string) so some searches become annoying. This does give me more control over selecting which properties the user wants publicly displayed.

Would a hybrid approach be better allowing me to balance the advantages and disadvantages of both methods? What method does SO use? Is there another approach to this that I haven’t thought of or missed?

Extension: With a hybrid approach would it be advantageous to also insert the properties from the user table into the user_profile table to control their visibility to other users or could that possibly be seen as additional overhead?

  • 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. 2026-05-11T01:29:48+00:00Added an answer on May 11, 2026 at 1:29 am

    The hybrid solution is not a good one. Essentially you are storing additional properties into a property bag table. That is going to make doing reporting and queries complicated in the long run. Also, storing dates, int, decimal, ntext, etc. as varchar is not going to be an acceptable exchange of performance for scalability. How would you create relations off that table, should the need arise?

    A better approach is to have a user table for user information. Then as your needs expand create new classes that represent the new features. Those new classes will likely have corresponding tables. That way your ‘user’ class doesn’t expand exponentially when properties associated with a user belong in their own space. Yes, in the future you might really have a new property that belongs in the user table. At that point you’ll need to go back and adjust your schema and DBAL, but that’s the price of code that is easy to understand.

    In your example you have address information for the user in the first user table. One thing I do is I know I’ll need to store addresses not just for users. So I’ll have a separate Address table then include a nullable AddressId in the User table. That way when I have a Stores table, an Events table, I can include AddressId relations there too. A side-effect of that approach is that when I go back and add lat/long to the Address object, everyone in my data model gets those new properties too.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.