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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:21:20+00:00 2026-05-23T14:21:20+00:00

I have a question about MySQL performance Query1: select departments.*, booth_feature.some_feature from departments left

  • 0

I have a question about MySQL performance

Query1:

select departments.*, booth_feature.some_feature
from departments
left join booth on booth.dept_id = departments.dept_id
left join booth_feature  on  booth.booth_id=booth_feature.booth_id

Query2:

select departments.*, booth_feature.some_feature
from departments
left join (booth, booth_feature) on ( booth.dept_id = departments.dept_id and booth.booth_id=booth_feature.booth_id)

Assuming:
department can have multiple booths

1 booth => 1 booth feature

both department and booth tables are big tables.

Using explain, the first query seems to be better (it checks on booth before booth_feature), despite the fact that left join is generally more expensive than inner join. Is that right?

  • 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-23T14:21:20+00:00Added an answer on May 23, 2026 at 2:21 pm

    You are basically doing a full cross join between booth and booth_feature in the second query, if these tables grow large, this have the potential of being quite costy. And the optimizer wont have a way of intelligently joining ‘departments’ with the cross product since it needs to calculate the full cross product before its able to join it with departments. Due to the lack of a join clause (making it a full cross product).

    in the first query, the optimizer can use indexes from departments and booths, and then use a reference (REF type in the MYSQL EXPLAIN output) from that result (based on both indexes) into another index (of booth_features)

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

Sidebar

Related Questions

I have a short question about mysql query. What is correct? SELECT * FROM
I have an question about MYSQL If statement. My request: SELECT c.status, c.thumb, j.id,
I have a question about my mysql query. I want to count the number
I have a question about this formula from a book: EFW (cm,kg)= 10^(-1,7492+(0,166*BPD)+(0,046*AC)-(2,646*AC*BPD/1000)) The
I have a question about mysql db. I created the site locally and now
I have a question about a MySQL query. I would (obviously) like to use
I have a question about tables in MySQL. I'm currently making a website where
I have question about parsing in Html helper : I have sth like: @foreach
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have question about XSLT1.0. The task is to write out in HTML all

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.