MySQL Forums
Forum List  »  Optimizer & Parser

Re: 2 column between optimization
Posted by: Brad Culberson
Date: September 02, 2005 02:25PM

+------------+
| version() |
+------------+
| 4.1.13a-nt |
+------------+

CREATE TABLE `geo_feature` (
`latitude` float default NULL,
`longitude` float default NULL,
`feature` varchar(50) default NULL,
KEY `GeoFeatureLocationBoundingBox` (`latitude`,`longitude`),
KEY `GeoFeatureLatitude` (`latitude`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8


| Table | Non_unique | Key_name | Seq_in_index | Column_name
| Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------------+------------+-------------------------------------------+--------------+---------------------------------
--+-----------+-------------+----------+--------+------+------------+---------+
| geo_feature | 1 | GeoFeatureLocationBoundingBox | 1 | latitude
| A | 239523 | NULL | NULL | YES | BTREE | |
| geo_feature | 1 | GeoFeatureLocationBoundingBox | 2 | longitude
| A | 2155714 | NULL | NULL | YES | BTREE | |
| geo_feature | 1 | GeoFeatureLatitude | 1 | latitude
| A | 239523 | NULL | NULL | YES | BTREE | |


For this optimization, We need to pull all the data in a certain bounding area by lat/lon thus the following query:

Select * from geo_feature where latitude BETWEEN .06494 and 0.7384 and longitude between -1.234 and -1.1212;

also tried:

Select * from geo_feature where latitude > .06494 and latitude < 0.7384 and longitude > -1.234 and longitude < -1.1212;

Thanks,
Brad

Options: ReplyQuote


Subject
Views
Written By
Posted
5703
September 02, 2005 12:39PM
2599
September 02, 2005 02:01PM
Re: 2 column between optimization
2704
September 02, 2005 02:25PM
2581
September 02, 2005 03:38PM
2456
September 06, 2005 09:17PM
2443
September 05, 2005 12:03PM
2499
September 06, 2005 09:18PM
2438
September 04, 2005 07:21PM
2440
September 06, 2005 09:14PM
2608
September 06, 2005 09:22PM
2395
September 06, 2005 11:17PM
2379
September 07, 2005 02:54AM
2711
September 07, 2005 02:48AM
2554
September 07, 2005 12:25PM
2358
September 07, 2005 12:54PM


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.