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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:13:05+00:00 2026-05-30T21:13:05+00:00

I often break my complicated queries into temporary tables so I can comment them

  • 0

I often break my complicated queries into temporary tables so I can comment them and help me comprehend the steps.

Does this differ greatly from how mysql handle’s nested joins internally?

e.g. select * from t1,t2,t3,t4 where t1.id=t2.id and t2.id2 = t3.id2, t4.id3 = t3.id3

Does an index(s) defined on t1 get “carried over” to whatever internal table mysql creates to hold intermediate results?

Is there any major difference performance wise between explicitly defining temporary tables or using one single query full of nested joins?

  • 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-30T21:13:07+00:00Added an answer on May 30, 2026 at 9:13 pm

    Indexes are not carried over to temporary tables you explicitly create. They’re just like regular tables, except that they’ll disappear when you no longer have the session open. The database has no knowledge that the data in the table originally came from a query on some other tables that had indexes; for one thing you might have inserted/deleted/updated rows in the temp table since the query.

    I would expect mysql to make use of any indexes it thought would be beneficial when you run joins, but the index has to be on a table in the join.

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

Sidebar

Related Questions

I often use this code pattern: while(true) { //do something if(<some condition>) { break;
Often, I found OutOfMemoryException on IBM Websphere Application Server. I think this exception occur
When working with legacy code, and trying to create tests, I often break out
I have often heard that using break s in Java is considered bad practice,
I often see JavaScript code which checks for undefined parameters etc. this way: if
This is a general kind of question. Very often, I need to write JavaScript
I often have to work with fragile legacy websites that break in unexpected ways
If you disassemble C# you often see temporary variables inserted by the compiler with
I'm hoping to get some tips to kinda help me break out of what
When doing a serious refactor in a Java Eclipse project I will often break

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.