Filtering

Identifying relationships between geometries, such as distance, intersections, and containment, requires Cartesian joins that typically need extensive calculations. When the tables contain large numbers of objects, this can result in long execution times. To improve performance, you can use filters to reduce the number of objects that need to be processed.

Sometimes, the data required by a filter is already available in a table. For example, in a table of geospatial objects that contains the postal code of each object, you might employ a filter to compare only objects that share the same postal code. However, if the data needed for filtering is not available, it can be calculated and added to an additional column or table that contains numeric values that represent the geometries. You can then add predicates to your queries to filter data based on these values.

The numeric values that represent a geometry are based on a geohash. There are several different types of geohash:
Geohash
A geohash is a number that uniquely identifies a specific region. A point resides in a single region and is represented by a single geohash value.
Geohash cover
A geohash cover is the set of geohash cells that are needed to completely cover a particular geometry. A line or a polygon can cross multiple regions and can therefore be represented by a set of geohash cover values.
Minimum bounding rectangle (MBR)
The MBR of a geometry is the bounding geometry formed by the minimum and maximum (X,Y) coordinates. A geohash minimum bounding rectangle cover is the set of geohash cells that are needed to cover the MBR completely.
When determining whether to use a geohash cover or a minimum bounding rectangle, consider the following:
  • A geohash cover is more precise then a geohash MBR. Because of this more geometries may be filtered out before calling the more time consuming geospatial functions.
  • The creation of a geohash MBR is faster then the creation of a geohash cover. Therefore, it takes less time to generate the geohash values when using a geohash MBR.