Home » Performance » MySQL » Query Speed Help
Query Speed Help [message #577] Wed, 10 January 2007 16:44 Go to previous message
Steele  is currently offline Steele
Messages: 1
Registered: January 2007
Junior Member
Hi all,

I've been breaking my head with this for a while now. I have a query, which is very slow and I'm trying to find a way to speed it up. It takes several seconds (usually between 3 and 10) to run the query.

----------------------------------------------------

TABLE STRUCTURE:

CREATE TABLE `ipcountry` (
`ipFROM` double unsigned NOT NULL default '0',
`ipTO` double unsigned NOT NULL default '0',
`countrySHORT` char(2) NOT NULL default '',
`countryLONG` varchar(255) NOT NULL default '',
`REGION` varchar(128) default NULL,
`CITY` varchar(128) default NULL,
`ISP_NAME` text,
PRIMARY KEY (`ipFROM`,`ipTO`),
KEY `ipFROM` (`ipFROM`),
KEY `ipTO` (`ipTO`)
) TYPE=MyISAM;


Number of records: 4,970,567

Index is on ipFROM and ipTO fields.

ipFROM and ipTO are integer numbers between 8 and 10 digits long.

----------------------------------------------------

QUERY:

SELECT countryLONG from ipcountry WHERE ipFROM <= 3521274926 AND ipTO >= 3521274926

This query basically looks up a value which is located in a range between 2 values in one record.

----------------------------------------------------

Any ideas how to speed it up?

Thanks!

[Updated on: Thu, 11 January 2007 09:55]

Read Message
Read Message
Previous Topic:Simple LEFT JOIN still uses file sort
Next Topic:Your professional standpoint: high cpu-load...
Goto Forum:

  


Current Time: Fri Jul 10 02:01:20 EDT 2009

Total time taken to generate the page: 0.01156 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.