MySQL Forums
Forum List  »  Performance

Re: Keys ignored for larger tables!?
Posted by: tamas marki
Date: April 06, 2011 05:04AM

Hi,

thanks for the quick reply.

Your index seems to have done the trick:

mysql> explain select id from arinrange where ip_start<=1582783255 and ip_end>=1582783255;
+----+-------------+-----------+-------+--------------------------------------------------+------------------+---------+------+---------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------+-------+--------------------------------------------------+------------------+---------+------+---------+--------------------------+
| 1 | SIMPLE | arinrange | range | iprange_ips_idx,iprange_ipe_idx,idx_start_end_id | idx_start_end_id | 5 | NULL | 1299610 | Using where; Using index |
+----+-------------+-----------+-------+--------------------------------------------------+------------------+---------+------+---------+--------------------------+

Though performance is still below what I expected (1-2 seconds for an uncached query).

Here are the tables:

mysql> show create table arinrange;
+-----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| arinrange | CREATE TABLE `arinrange` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ip_start` int(10) unsigned DEFAULT NULL,
`ip_end` int(10) unsigned DEFAULT NULL,
`arin_data` text,
PRIMARY KEY (`id`),
KEY `iprange_ips_idx` (`ip_start`),
KEY `iprange_ipe_idx` (`ip_end`)
) ENGINE=MyISAM AUTO_INCREMENT=3480336 DEFAULT CHARSET=latin1 |
+-----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.18 sec)

mysql> show create table lacnicrange;
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| lacnicrange | CREATE TABLE `lacnicrange` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ip_start` int(10) unsigned DEFAULT NULL,
`ip_end` int(10) unsigned DEFAULT NULL,
`lacnic_data` text,
PRIMARY KEY (`id`),
KEY `lacnicrange_ips_idx` (`ip_start`),
KEY `lacnicrange_ipe_idx` (`ip_end`)
) ENGINE=MyISAM AUTO_INCREMENT=94594 DEFAULT CHARSET=latin1 |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Any hints on how I could maximize performance (and minimize query durations) in this scenario would be welcome.

Thanks!

Options: ReplyQuote


Subject
Views
Written By
Posted
2513
April 06, 2011 04:00AM
Re: Keys ignored for larger tables!?
882
April 06, 2011 05:04AM
1599
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.