Run

explain select * from A,B where A.col1=B.col1;

The explain plan for your query will tell you what indexes are chosen.
If your explain plan says what you do not like, definitely add an index on col1 
in B.

Make sure you run OPTIMIZE TABLE on both tables.

The, run explain select * from A,B where A.col1=B.col1; again
See what the explain plan says afterwards.

Give it a try !!!

----- Original Message -----
From: "John Mancuso" <[EMAIL PROTECTED]>
To: mysql@lists.mysql.com
Sent: Thursday, June 21, 2007 10:07:39 AM (GMT-0500) America/New_York
Subject: index question

If I have 2 large tables A and B and I need to join them:
 
select * from A,B where A.col1=B.col1
 
If A.col1 is an index and B.col1 is not, if I create an index on B.col1
will this index be used? In other words how are indexes used on table
joins?
 
Thanks
 
John Mancuso
Linux Administrator/MySQL DBA
IT Infrastructure
American Home Mortgage
w: 631-622-6382
c: 516-652-2475
 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to