| | |
Why tb1.Name=tb2.Name does not use index on Name
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2008
Posts: 15
Reputation:
Solved Threads: 0
Hello ALL,
I did the following query. the EXPLAIN result showed 'NULL' in the 'key' colume, meaning that NONE of indexes have been used. However, indexes have been created on Name fields for both tb1 and tb2. I wonder why MySQL does not use the indexes to speed up the query. Is there any way to make the query faster?
I did the following query. the EXPLAIN result showed 'NULL' in the 'key' colume, meaning that NONE of indexes have been used. However, indexes have been created on Name fields for both tb1 and tb2. I wonder why MySQL does not use the indexes to speed up the query. Is there any way to make the query faster?
MySQL Syntax (Toggle Plain Text)
EXPLAIN SELECT tb1.Name FROM tb1, tb2 WHERE tb1.Name = tb2.Name;
•
•
Join Date: Aug 2008
Posts: 1,162
Reputation:
Solved Threads: 137
are you using a foreign key on the name column?
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
•
•
Join Date: Jun 2008
Posts: 79
Reputation:
Solved Threads: 8
See if you force mysql to use index
and also check it name column is of same data type in both the tables
MySQL Syntax (Toggle Plain Text)
EXPLAIN SELECT tb1.Name FROM tb1, tb2 FORCE index(t1.name) WHERE tb1.Name = tb2.Name;
and also check it name column is of same data type in both the tables
:- Varma
We are Happy to inform launch of a new site with loads of database related information Site offers wide range of functionality Forums,Blogs,Articles,Editorials and much more
http://www.sqllibrarian.info/
We are Happy to inform launch of a new site with loads of database related information Site offers wide range of functionality Forums,Blogs,Articles,Editorials and much more
http://www.sqllibrarian.info/
![]() |
Similar Threads
Other Threads in the MySQL Forum
- Previous Thread: MySQL Migr Toolkit, Generic JDBC ".. schema names could not be retrieved (error: 0)."
- Next Thread: query execution time
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm data database design developer development distinct drupal dui ec2 email enter enterprise eudora facebook form foss gartner gnu government gpl greenit groklaw groupware images innerjoins insert ip joebrockmeier join journalism keyword keywords laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php priceupdating referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization






