Solved

MySQL JOIN Clause

Posted on 2014-12-03
3
466 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 108

Author Closing Comment

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

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
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 …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now