Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
admin:optimization:geo:optimization [2010/07/28 15:00]
els
— (current)
Line 1: Line 1:
-{{page>:​top_add&​nofooter&​noeditbtn}} 
  
-====== Geographic Searches - Indexing ====== 
- 
-[[admin:​optimization:​geo:​home|Overview]] -> [[admin:​optimization:​geo:​latlong|Latitude and Longitude]] -> [[admin:​optimization:​geo:​radius|Radius Distance Searches]] -> [[admin:​optimization:​geo:​indexing|Indexing]] -> **[[admin:​optimization:​geo:​optimization|Optimization]]** 
- 
-===== Optimizing Geographic Searches ===== 
- 
-Geographic searches are specified using a [[dev:​sql:​functions:​distance|$distance function]]. ​ As long as there is a multi-column Omnidex index containing the latitude and longitude, the $distance function will be automatically optimized. 
- 
-There are several types of geographic searches that can be optimized using the $distance function: 
- 
-== Compare two sets of literal latitudes and longitudes == 
- 
-<​code>​ 
-select ​     $distance(40.0,​ -105.0, 41.0, -106.0) ​ 
-  from     $omnidex ​ 
-</​code>​ 
- 
-== Compare latitudes and longitudes in a table against constant latitude and longitude == 
- 
-<​code>​ 
-select ​     $distance(40.0,​ -105.0, latitude, longitude), ​ 
-            latitude, longitude, 
-  from      geo 
- ​where ​     $distance(40.0,​ -105.0, latitude, longitude) < 10 
-</​code>​ 
- 
-== Compare latitudes and longitudes in a table against single latitude and longitude derived from a nested query == 
- 
-<​code>​ 
-select ​     latitude, longitude, 
-  from      geo 
-  where     ​$distance((select ​     latitude, longitude ​ 
-                         ​from ​     zipcodes ​ 
-                         ​where ​    zip = ‘80301’),​ 
-                      latitude, longitude) < 10 
-</​code>​ 
- 
-== Compare latitudes and longitudes in a table against multiple latitudes and longitudes derived from a nested query == 
- 
-<​code>​ 
-select ​     latitude, longitude, 
-  from      geo 
- ​where ​     $distance((select ​     latitude, longitude ​ 
-                         ​from ​     zipcodes ​ 
-                        where      region = '​MT'​),​ 
-                      latitude, longitude) < 10 
-</​code>​ 
- 
-{{page>:​bottom_add&​nofooter&​noeditbtn}} 
 
Back to top
admin/optimization/geo/optimization.1280329209.txt.gz · Last modified: 2012/10/26 14:52 (external edit)