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

  • Home
  • SEARCH
  • 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 6540427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:58:41+00:00 2026-05-25T10:58:41+00:00

On my site when some user create profile he also choose his school name.

  • 0

On my site when some user create profile he also choose his school name. Schools have the table in database. The main page in applicatioin should display some data about users school. And there are a few links that display something based on school ID.

Now I have two options:

  1. When user log in I get SchoolID based on userID and save it in session?
  2. Whenever I need to open something that request schoolID I send call to database to get schoolID based on userID?
  3. Something else.

Performance and security are my proprities becaouse thera are a lot users.

  • 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-25T10:58:42+00:00Added an answer on May 25, 2026 at 10:58 am

    The performance gain by caching the schoolId is so minor that number 2 is your best option. Getting the schoolId based on userId would be a very quick lookup. Number 1 has the potential bug that you forget to update session when the user edits their school. It also assumes that schoolId would only be set within the session. The day you break that assumption by importing updates or the admin updates, the session will not match the data and all sorts of problems may ensue.

    Of course, getting the school data should be one command:
    select School.* from School inner join User on User.SchoolId = School.SchoolId where User.UserId = @UserId

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

Sidebar

Related Questions

I have textarea in my site(link shortening site) i want to user enter some
I have some user generated content I'm trying to render on my site. The
Some background I'm currently working on a mobile site so I keep switching user
Some site I'm programming is using both ASP.NET MVC and WebForms. I have a
I have some site where I am embedding a couple of youtube videos in
I have public site with some forms. Simple question: What kind of informations should
I have a site where some users will be registered by our staff, and
For the site I'm working on, I want a user to have the ability
I have a website that allows a user to create blog posts. There are
I'm building a site that allows users to create a profile. Each profile page

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.