等待 SQL:202y: 向量

  • 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 vector data type with two arguments (dimension count and coordinate type). Utility functions like vector_dimension_count(), vector_norm(), and vector_serialize() are available. Vectors can be compared for similarity using functions like cosine, dot, etc. in vector_distance(). Usually, results are ordered by vector distance and a top-N limit is applied. Approximate results are now supported with the FETCH APPROX FIRST clause, 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 vector data type.
    • Operations on vector type with various functions.
    • Comparison and sorting by vector distance.
    • Use of FETCH APPROX FIRST for approximate results.
    • Extension for specifying a range of approximate results.
  • Key Information:

    • Naming convention for next SQL standard as SQL:202y.
    • vector type arguments and example usage.
    • Different vector similarity calculation functions.
    • Default use of APPROX with vector type.
  • Important Details:

    • How to insert data into vector type.
    • 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.
阅读 12
0 条评论