From 9ce7c8b64f24d20d3bd776b9277df79e3513a89d Mon Sep 17 00:00:00 2001 From: Ke Wang Date: Thu, 19 Mar 2026 20:45:58 -0700 Subject: [PATCH] feat: Add documentation for CREATE VECTOR INDEX (#27332) Summary: Pull Request resolved: https://github.com/prestodb/presto/pull/27332 Pull Request resolved: https://github.com/prestodb/presto/pull/27331 Add documentation for CREATE VECTOR INDEX ## Release Notes ``` == NO RELEASE NOTE == ``` Reviewed By: zhichenxu-meta Differential Revision: D96414538 --- presto-docs/src/main/sphinx/sql.rst | 1 + .../main/sphinx/sql/create-vector-index.rst | 52 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 presto-docs/src/main/sphinx/sql/create-vector-index.rst diff --git a/presto-docs/src/main/sphinx/sql.rst b/presto-docs/src/main/sphinx/sql.rst index 042bcfea7ad35..3420b6bf43a87 100644 --- a/presto-docs/src/main/sphinx/sql.rst +++ b/presto-docs/src/main/sphinx/sql.rst @@ -19,6 +19,7 @@ This chapter describes the SQL syntax used in Presto. sql/create-schema sql/create-table sql/create-table-as + sql/create-vector-index sql/create-view sql/create-materialized-view sql/deallocate-prepare diff --git a/presto-docs/src/main/sphinx/sql/create-vector-index.rst b/presto-docs/src/main/sphinx/sql/create-vector-index.rst new file mode 100644 index 0000000000000..c691fec5c9845 --- /dev/null +++ b/presto-docs/src/main/sphinx/sql/create-vector-index.rst @@ -0,0 +1,52 @@ +=================== +CREATE VECTOR INDEX +=================== + +Synopsis +-------- + +.. code-block:: none + + CREATE VECTOR INDEX index_name + ON source_table ( column_name [, ...] ) + [ WITH ( property_name = expression [, ...] ) ] + [ UPDATING FOR predicate ] + +Description +----------- + +Create a vector search index on the specified columns of a source table. + +The ``column_name`` list specifies the columns to index. Typically this includes +an identifier column and an embedding (vector) column. + +The optional ``WITH`` clause sets index properties such as: + +- ``index_type``: The type of vector index (for example, ``'ivf_rabitq4'``) +- ``distance_metric``: The distance metric to use (for example, ``'cosine'``) +- ``index_options``: Additional index configuration (for example, ``'nlist=100000,nb=8'``) +- ``partitioned_by``: Partition columns (for example, ``ARRAY['ds']``) + +The optional ``UPDATING FOR`` clause filters the source data using a predicate, +similar to a ``WHERE`` clause. This is typically used to specify which partitions +to build the index for. + +Examples +-------- + +Create a vector index on an embeddings table for specific date partitions:: + + CREATE VECTOR INDEX my_index + ON my_table(content_id, embedding) + WITH ( + index_type = 'ivf_rabitq4', + distance_metric = 'cosine', + index_options = 'nlist=100000,nb=8', + partitioned_by = ARRAY['ds'] + ) + UPDATING FOR ds BETWEEN '2024-01-01' AND '2024-01-03' + +See Also +-------- + +:doc:`create-table`, :doc:`create-table-as`