Solved

MySQL JOIN Clause

Posted on 2014-12-03
3
478 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
3 Comments
 
LVL 10

Accepted Solution

by:
JEaston 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 142

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 109

Author Closing Comment

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

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Creating and Managing Databases with phpMyAdmin in cPanel.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

808 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