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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:38:38+00:00 2026-05-29T03:38:38+00:00

My question is there any way to better manage this database implementation. Background: Web

  • 0

My question is there any way to better manage this database implementation.

Background:

Web page worked with mysql, php and javascript.

Assuming the following table (simplified for the discussion):

*user_table*

user_id (PK)
user_name

*thread_table*

thread_id (PK)
user_id (Index) 
thread_title

I want a view with a list of the thread titles together with the user publishing them.

So this would be my usual query:

SELECT thread_title, thread_table.user_id, user_name 
FROM thread_table INNER JOIN user_table
WHERE user_table.user_id = thread_table.user_id

My question is, would be this the most efficient way (faster) to get the user_name having the user_id?

This is a simplified example, but I have more complex queries, joining different tables and it’s “painful” to have to join another table only to get the user_name.

So what could I do to improve the effectiveness of this execution? At least should I make a memory table of user_table with a hash key to better get the user_name having the user_id?

Thanks!!

  • 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-29T03:38:38+00:00Added an answer on May 29, 2026 at 3:38 am

    This is the correct implementation. If JOINs are painful to you, then you are using the wrong tool! JOINs are an inherent part of SQL, and that fact that you need to use a JOIN to retrieve a specific piece of information does not mean that you should change your schema.

    If this is a common pattern that you use over and over in other queries, then it is a perfect candidate for a view. Then you can use that view in other queries, and eliminate some typing.

    If performance is really a concern, you can start to look into denomralization, but I am not getting the sense that you are at that stage here. Posting your query times and the output of EXPLAIN PLAN would help diagnose this further.

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

Sidebar

Related Questions

Sorry for this silly question, but is there any way to restrict using directives
Maybe this is a dumb question, but is there any way to convert a
I have a webapp written in PHP using a MySQL database backend. This question
Simple question here: is there any way to convert from a jagged array to
Weird question, but i need to find an answer. Is there any way, in
I have seen this question: Are there any decent UI components for touch screen
This is a simple question : Is there any automatic indentation alignment on Eclipse
Question: Is there any reason Autocomplete=off on a ASP:Textbox would not be working in
Just a curious question but is there any programs that can help/aid you when
(See question below for more context): Are there any situations in which <machineKey validationKey=AutoGenerate,IsolateApps

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.