16.20 - Geospatial Single-Table Predicates - Teradata Vantage NewSQL Engine

Teradata Vantageā„¢ Geospatial Data Types

Teradata Database
Teradata Vantage NewSQL Engine
March 2019
Programming Reference
Geospatial single-table predicates cause the optimizer to evaluate a geospatial index, if one exists, as a potential access path to the geospatial data. In these circumstances, the index can greatly speed access to the data and execution of the query. Supported single-table predicates, excluding the distance methods ST_Distance and ST_3DDistance, use any of the following forms:
SELECT a, b FROM TableName
WHERE TableName.GeoCol.SupportedGeoMethod(GeospatialLiteralExpression)=1
SELECT a, b FROM TableName
WHERE GeospatialLiteralExpression.SupportedGeoMethod(TableName.GeoCol) = 1
The expression must be set to evaluate to 1 (true) for these to qualify as a single-table predicates.
SELECT a, b, FROM  TableName
WHERE TableName.GeoCol IS NULL
Single-table distance predicates are those that use the ST_Distance and ST_3DDistance methods. They can use any of the following forms:
SELECT a, b FROM TableName
WHERE TableName.GeoCol.
SupportedGeoDistanceMethod(GeospatialLiteralExpression) < DistanceLiteral
SELECT a, b FROM TableName
WHERE GeospatialLiteralExpression.
SupportedGeoDistanceMethod(TableName.GeoCol) < DistanceLiteral
You can use either the < or <= operator to form these predicates.
Syntax Element Description
TableName Table containing a geospatial data column.
GeoCol Geospatial data column defined as one of the ST_GEOMETRY types.
SupportedGeoMethod One of the geospatial methods listed above, excluding ST_Distance and ST_3DDistance.
SupportedGeoDistanceMethod Either ST_Distance or ST_3DDistance.
GeospatialLiteralExpression An arbitrary geospatial literal expression that can be folded (simplified) in to a geospatial literal value.
DistanceLiteral A floating point value representing a distance.