MySQL Forums :: Performance :: Slow query


Advanced Search

Slow query
Posted by: Dragos Gabriel Iancu ()
Date: February 11, 2011 08:55AM

Hi. I have a query that executs slow. I have index on columns but still it is slow.

The query is:
mysql> explain SELECT locId, location.city as city,latitude,longitude FROM ip2isp join location on ip2isp.location=locId WHERE INET_ATON('x.x.x.x') BETWEEN start AND end;
+----+-------------+----------+--------+-------------------+---------+---------+---------------------------------+---------+-------------+
| id | select_type | table    | type   | possible_keys     | key     | key_len | ref                             | rows    | Extra       |
+----+-------------+----------+--------+-------------------+---------+---------+---------------------------------+---------+-------------+
|  1 | SIMPLE      | ip2isp   | ALL    | isp2idx,start,end | NULL    | NULL    | NULL                            | 1126339 | Using where |
|  1 | SIMPLE      | location | eq_ref | PRIMARY           | PRIMARY | 4       | transfer_ro_pre.ip2isp.location |       1 | Using where |
+----+-------------+----------+--------+-------------------+---------+---------+---------------------------------+---------+-------------+
2 rows in set (0.00 sec)

mysql>

It seems like it dosn`t use indexes.

I create the indexes like:
mysql> alter table ip2isp add key using btree (start);
mysql> alter table ip2isp add key using btree (end);

Options: ReplyQuote


Subject Views Written By Posted
Slow query 2051 Dragos Gabriel Iancu 02/11/2011 08:55AM
Re: Slow query 760 Rick James 02/12/2011 03:32PM
Re: Slow query 868 Dragos Gabriel Iancu 02/14/2011 07:55AM
Re: Slow query 641 Thomas Wiedmann 02/14/2011 08:12AM
Re: Slow query 636 Dragos Gabriel Iancu 02/14/2011 09:59AM
Re: Slow query 562 Thomas Wiedmann 02/14/2011 10:57AM
Re: Slow query 597 Rick James 02/14/2011 06:51PM
Re: Slow query 587 Dragos Gabriel Iancu 02/15/2011 03:21AM
Re: Slow query 825 Rick James 02/15/2011 11:17AM


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.