Perform nearest-neighbor searches
If the DataBlade® module you are using is set up for it, you can perform nearest-neighbor searches.
After you create an R-tree index on the column on which you want to perform nearest-neighbor queries, you can use the functions that your DataBlade® documentation identifies as nearest-neighbor functions to perform nearest-neighbor queries.
Nearest-neighbor searches return results in order of increasing distance from the specified object or location. Without any other restriction, a nearest-neighbor query returns a result for all rows that are returned by the query. Often, you want to restrict the results, for example, using the FIRST n syntax to obtain just the first few results .
The WHERE clause of a nearest-neighbor query can include other qualifications, provided the clause is connected by AND.
A DataBlade® module might provide more than one nearest-neighbor function. For example, a Nearest function calculates precise distances between objects, while a NearestBBox function calculates distances as measured between objects' bounding boxes (envelopes). Because this calculation is simpler, NearestBBox runs more quickly but might return objects in a different order that depends on the actual shape of the objects.