- Summary: Since SQL:2023 was published, work on the SQL standard continues. Vectors have become popular in databases related to LLM and "AI" use cases. SQL now has a new
vectordata type with two arguments (dimension count and coordinate type). Utility functions likevector_dimension_count(),vector_norm(), andvector_serialize()are available. Vectors can be compared for similarity using functions likecosine,dot, etc. invector_distance(). Usually, results are ordered by vector distance and a top-N limit is applied. Approximate results are now supported with theFETCH APPROX FIRSTclause, and an additional extension allows specifying a range. Indexing for vectors is not part of the standard and is up to the implementation. Main Points:
- SQL standard progress after SQL:2023.
- Introduction of
vectordata type. - Operations on
vectortype with various functions. - Comparison and sorting by vector distance.
- Use of
FETCH APPROX FIRSTfor approximate results. - Extension for specifying a range of approximate results.
Key Information:
- Naming convention for next SQL standard as SQL:202y.
vectortype arguments and example usage.- Different vector similarity calculation functions.
- Default use of
APPROXwith vector type.
Important Details:
- How to insert data into
vectortype. - Explanation of how to use
vector_distance()with different functions. - Illustration of applying top-N limit and approximate range.
- Note that indexing for vectors is implementation-dependent.
- How to insert data into
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用。你还可以使用@来通知其他用户。