Feb 25, 2009

Oracle Spatial hint

For an optimal execution plan, always specify the /*+ ordered */ hint when the query window
(second argument of a spatial operator) comes from a table. For example, the following query
finds all the chemical plants within 5 miles of contaminated wells with ID values 1 and 2.

b.chemical_plant_name FROM well_table a,chemical_plants b
WHERE sdo_within_distance (b.geom, a.geom, 'distance=5
unit=mile') = ‘TRUE’ AND a.id in (1,2);

No comments: