Solved

MySQL JOIN Clause

Posted on 2014-12-03
3
496 Views
Last Modified: 2014-12-03
Scenario:  I have two MySQL tables.  Both of them have an index on the column called "foo."  

1. I run a SELECT query and use a JOIN clause naming "foo" in the two tables.  I get a results set giving the intersection of the tables on "foo."

2. I remove the index from one or both of the tables and rerun the query in #1.

Will I get the same results set from the second (unindexed) SELECT?  Or does the presence of an index affect the results of JOIN?
0
Comment
Question by:Ray Paseur
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 11

Accepted Solution

by:
John Easton earned 250 total points
ID: 40478242
If I understand your question correctly, then Yes you should get the same result regardless of whether the joined columns are indexed or not.  Indexed columns are likely to result in a faster query run time - but if the tables are not large then chances are you will not notice the difference.
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
ID: 40478254
I agree 100%: the presence of indexes will not change the data returned, only the speed
0
 
LVL 110

Author Closing Comment

by:Ray Paseur
ID: 40478269
Thanks, colleagues!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question