Re: Keys ignored for larger tables!?
mysql> explain
-> select start.id
-> from ( select id from arinrange where ip_start<=1582783255 ) start
-> join ( select id from arinrange where ip_end>=1582783255 ) end
-> on start.id = end.id;
+----+-------------+------------+-------+------------------+------------------+---------+------+---------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+-------+------------------+------------------+---------+------+---------+--------------------------+
| 1 | PRIMARY | <derived3> | ALL | NULL | NULL | NULL | NULL | 674023 | |
| 1 | PRIMARY | <derived2> | ALL | NULL | NULL | NULL | NULL | 1316679 | Using where |
| 3 | DERIVED | arinrange | range | idx_end_start_id | idx_end_start_id | 4 | NULL | 727188 | Using where; Using index |
| 2 | DERIVED | arinrange | range | idx_start_end_id | idx_start_end_id | 4 | NULL | 1263515 | Using where; Using index |
+----+-------------+------------+-------+------------------+------------------+---------+------+---------+--------------------------+
4 rows in set (1.87 sec)
mysql>
mysql> explain select id from arinrange where 1582783255 between ip_start and ip_end ;
+----+-------------+-----------+-------+-----------------------------------+------------------+---------+------+--------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------+-------+-----------------------------------+------------------+---------+------+--------+--------------------------+
| 1 | SIMPLE | arinrange | range | idx_start_end_id,idx_end_start_id | idx_end_start_id | 4 | NULL | 727188 | Using where; Using index |
+----+-------------+-----------+-------+-----------------------------------+------------------+---------+------+--------+--------------------------+
1 row in set (0.00 sec)
Subject
Views
Written By
Posted
2535
April 06, 2011 04:00AM
991
April 06, 2011 04:52AM
886
April 06, 2011 05:04AM
866
April 06, 2011 05:10AM
749
April 06, 2011 05:20AM
943
April 06, 2011 05:35AM
847
April 07, 2011 04:23AM
917
April 07, 2011 05:39AM
Re: Keys ignored for larger tables!?
871
April 07, 2011 05:59AM
814
April 07, 2011 07:08AM
864
April 07, 2011 07:17AM
846
April 07, 2011 01:30PM
1600
April 08, 2011 08:20PM
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.