---
schema_version: "1"
id: ff5ff59e50f309ce2ca1ed29f58173b813faf2259807415df75b9d42f21e691b
title: DOT_PRODUCT
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-sql-reference/scalar-func/array-func/dot-product.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/dot-product.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 20210f282451d7d7b5af66b35e6243336775b1bf176989913921a5db3f13e1f1
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `DOT_PRODUCT`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Computes the conventional dot product (scalar product) of two vectors.

## Syntax

```sql
dot_product(<array1>, <array2>)
```

## Arguments

### Required

- `<array1>`: The first vector (`array(real)` or `array(double precision)`).
- `<array2>`: The second vector (`array(real)` or `array(double precision)`).

## Returns

Returns a double-precision value that represents the dot product of the two vectors.

## Considerations

- Both input arrays must be of the same element type and length.
- If any element is NULL, the result is NULL.
- For optimal performance, use array definitions with non-nullable elements such as `array(real not null)`.

## Examples

### Calculate Dot Product

Compute the dot product of two vectors.

```sql
SELECT dot_product(array[1, 2, 3], array[-1, 2, -3]) AS result;
```

Returns `-6.0`, calculated as (1 × -1) + (2 ×2 ) + (3 × -3) = -1 + 4 - 9 = -6.

## Related Documentation

- [Array Data Type](https://developer.salesforce.com/docs/data/data-cloud-query-guide/datatype/array.md)
