Optional Syntax Elements for TD_VectorDistance - Teradata VantageCloud Lake

Lake - Analyze Your Data with ClearScape Analytics™

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2026-02-20
dita:mapPath
tcl1683670667798.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
tcl1683670667798
ON clause
Accepts the ReferenceTable clause.
RefIDColumn
Specify the name of the reference table column that contains identifiers of the reference table vectors.
RefFeatureColumns
List of reference table column names that contain features of the reference table vectors.
You can specify up to 2018 feature columns.

When providing embedding types, TargetFeatureColumns and RefFeatureColumns must have 1 column.

DistanceMeasure
Specifies the distance type to compute between the target and the reference vector:
  • Cosine: Cosine distance between the target vector and the reference vector.
  • Euclidean: Euclidean distance between the target vector and the reference vector.
  • Manhattan: Manhattan distance between the target vector and the reference vector.
  • Dot product: Dot product distance between the target vector and the reference vector.
    Both target and ref vectors must be normalized for dot product distance.
  • Minkowski: Minkowski distance between the target vector and the reference vector.

Default: cosine

TopK
Maximum number of closest reference vectors to include in the output table for each target vector. The value k is an integer between 1 and 1024.

Default value: 1024

Important: TD_VectorDistance returns N2 output if you use the TopK value as -1 because the function includes all reference vectors in the output table.
TopK and SearchThresholds cannot be provided together. If both are omitted, then topk = 1024 will be considered.
PValue
Specifies the integer value needed to compute the minkowski distance.

Default value = 2

Range 1-INT_MAX

SearchThresholds
Specifies the search threshold between a pair of target and reference vectors.

The pair does not appear in the output table if the distance exceeds the search threshold.

The pair does not appear in the output table if the similarity is less than the search threshold.

If DistanceMeasure specifies multiple measures, then SearchThresholds must specify a threshold for each measure.

The ith threshold corresponds to the ith measure.

SearchThresholds and TopK cannot be provided together, otherwise an error is reported. If both are omitted, then topk = 1024 will be considered.
LargeReferenceInput
If the reference table is much larger than the target table, then passing true in this syntax element will treat the reference table as 'Partition By any' instead of 'Dimension', and the targetTable will be treated as Dimension. You must pass the reference table as 'Partition By any' and target table as Dimension.

True (true, t, yes, y, 1) False (false, f, no, n, 0)

Default: False (the reference table will be Dimension only)

OutputSimilarity
Specifies true if you want similarity instead of distance.

True (true, t, yes, y, 1) False (false, f, no, n, 0)

Default: False (the function will emit the distance)

Similarity is computed in the following manner:
  • Cosine_similarity = 1 - Cosine_distance
  • Euclidean_similarity = 1/(1 + Euclidean_distance)
  • Manhattan_similarity = 1/(1 + Manhattan_distance)
  • Dot product_similarity = 1 - DotProduct_distance
    Both target and ref vectors must be normalized for dot product similarity.
  • Minkowski_similarity = 1/(1 + minkowski_distance)
EmbeddingSize
Specify the embedding size of the vectors.

Max value = 4096

UseSIMD
Specifies whether to invoke SIMD instruction set for computing vector operations (distance between vectors).

Default: false