Hello all,
Given this table:
DROP TABLE IF EXISTS `maprimary`.`tbl_locales_ip2l`;
CREATE TABLE `maprimary`.`tbl_locales_ip2l` (
`ipStart` int(10) unsigned zerofill NOT NULL default '0000000000',
`ipEnd` int(10) unsigned zerofill NOT NULL default '0000000000',
`countryCode` varchar(2) default NULL,
`country` varchar(100) default NULL,
`state` varchar(100) default NULL,
`city` varchar(120) default NULL,
`lat` float NOT NULL default '0',
`lon` float NOT NULL default '0',
`zipCode` varchar(10) NOT NULL default '0',
`timeZone` int(10) NOT NULL default '0',
PRIMARY KEY USING BTREE (`ipStart`,`ipEnd`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
When I use this query:
SELECT * FROM `tbl_locales_ip2l` WHERE `ipStart` <= 3741319167 AND
`ipEnd` >= 3741319167;
I can see that the primary key is not used and the query takes about 3 sec.
But when I use this query:
SELECT * FROM `tbl_locales_ip2l` WHERE `ipStart` <= 374131916 AND
`ipEnd` >= 374131916;
The primary key is used.
The table contains about 3M rows.
Can anyone explain?
Thanks, Sharon.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]