Solved

MySQL JOIN Clause

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

910 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

23 Experts available now in Live!

Get 1:1 Help Now