MySQL Forums
Forum List  »  Optimizer & Parser

Re: two column int index not used correctly
Posted by: Ming Lu
Date: June 20, 2011 12:20AM

Hi, Jørgen

Thanks:)
And sorry for the late response.

EXPLAIN 
SELECT
    A.*,
    ip_range_table.ip_class
FROM web_query.web_query_ip_dest_analysis_20110616171614564_merged AS A
    JOIN ip_range_table FORCE INDEX (idx_start_ip) ON A.ip>=ip_range_table.start_ip;

The output is:
+----+-------------+----------------+------+---------------+------+---------+------+---------+--------------------------------+
| id | select_type | table          | type | possible_keys | key  | key_len | ref  | rows    | Extra                          |
+----+-------------+----------------+------+---------------+------+---------+------+---------+--------------------------------+
|  1 | SIMPLE      | ip_range_table | ALL  | idx_start_ip  | NULL | NULL    | NULL |    1347 |                                |
|  1 | SIMPLE      | A              | ALL  | NULL          | NULL | NULL    | NULL | 1566774 | Using where; Using join buffer |
+----+-------------+----------------+------+---------------+------+---------+------+---------+--------------------------------+

And I also tried this:
SELECT
    A.*,
    ip_range_table.ip_class
FROM web_query.web_query_ip_dest_analysis_20110616171614564_merged AS A
    JOIN ip_range_table FORCE INDEX FOR JOIN (idx_start_ip) ON A.ip>=ip_range_table.start_ip;

The output is same:
+----+-------------+----------------+------+---------------+------+---------+------+---------+--------------------------------+
| id | select_type | table          | type | possible_keys | key  | key_len | ref  | rows    | Extra                          |
+----+-------------+----------------+------+---------------+------+---------+------+---------+--------------------------------+
|  1 | SIMPLE      | ip_range_table | ALL  | idx_start_ip  | NULL | NULL    | NULL |    1347 |                                |
|  1 | SIMPLE      | A              | ALL  | NULL          | NULL | NULL    | NULL | 1566774 | Using where; Using join buffer |
+----+-------------+----------------+------+---------------+------+---------+------+---------+--------------------------------+

Options: ReplyQuote




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.