MySQL Forums
Forum List  »  Performance

Re: MySQL not using indexes
Posted by: Rick James
Date: February 25, 2011 07:44AM

SELECT  *
    FROM  territory_borders_finished, territories_finished
    where  tb_game_number=378664
      and  te_game_number=378664
      and  tb_border = te_code
    ORDER BY  tb_territory;

The "standard" way to specify that query is
SELECT  *
    FROM  territory_borders_finished, territories_finished
    where  tb_game_number=te_game_number  -- I changed this
      and  te_game_number=378664
      and  tb_border = te_code
    ORDER BY  tb_territory;
See if that works out better. Also, add
INDEX(tb_game_number, tb_border, tb_territory)
It may help even more.

By saying tb_game_number=te_game_number instead of tb_game_number=(constant), MySQL realizes that you are tying the tables together.

Options: ReplyQuote


Subject
Views
Written By
Posted
3618
February 23, 2011 01:31AM
1213
February 23, 2011 08:16AM
1083
February 23, 2011 09:58AM
1179
February 24, 2011 09:26AM
1211
February 24, 2011 12:25PM
1458
February 24, 2011 03:36PM
1126
February 24, 2011 06:57PM
1560
February 24, 2011 08:49PM
1045
February 25, 2011 12:52AM
Re: MySQL not using indexes
1033
February 25, 2011 07:44AM
929
February 25, 2011 11:40AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.