> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lancedb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Functions

> Where to find each kind of function, and the dialect version they come from.

**Applies to:** Embedded ❌, Enterprise ✅

LanceDB executes SQL with [Apache DataFusion](https://datafusion.apache.org),
currently **version 54**. The function set is DataFusion's default registration
plus what Lance adds.

| | |
| - | - |
| [Scalar functions](https://docs.lancedb.com/sql/dql/scalar-functions.md) | per row: math, string, regex, date/time, array, struct |
| [Aggregate functions](https://docs.lancedb.com/sql/dql/aggregation.md#functions) | per group: `count`, `sum`, statistical, approximate |
| [Window functions](https://docs.lancedb.com/sql/dql/window.md#functions) | per window: ranking, offset, running aggregates |
| [Table functions](#table-functions) | produce a relation rather than a value |

> [!NOTE]
>
> Function availability is version-specific. DataFusion adds functions in most
> releases, so one documented on `main` may not exist in 54. When a name is not
> recognised, check it against the reference for that version before assuming a
> bug.

## Table functions

A table function appears in `FROM` and produces a relation, which is what lets
it return columns a scalar function has nowhere to put. Each has its own
reference page:

| | |
| - | - |
| [`fts(table, query)`](https://docs.lancedb.com/sql/dql/fts) | full-text search, with a relevance score alongside the matching rows |
| [`dedupe(table, column, ...)`](https://docs.lancedb.com/sql/dql/dedupe) | one representative row per near-duplicate group |
| [`duplicate_pairs(table, column, ...)`](https://docs.lancedb.com/sql/dql/duplicate-pairs) | every close pair, before resolving into groups |
| [`generate_series(start, stop)`](https://docs.lancedb.com/sql/dql/generate-series) | rows from a range |

`_score`, the relevance pseudo-column `fts()` produces, is not a function;
see [Data types](https://docs.lancedb.com/sql/data-types.md#pseudo-columns).

## What Lance accelerates

`contains_tokens` uses an index rather than scanning, which is the difference
between a fast predicate and a slow one:

| | Index used |
| - | - |
| [`contains_tokens`](https://docs.lancedb.com/sql/dql/contains-tokens) | full-text index |

Confirm with [`EXPLAIN`](https://docs.lancedb.com/sql/dql/explain): an accelerated predicate shows an
index node rather than a `LanceScan` followed by a filter.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.