Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix
Browse files Browse the repository at this point in the history
nautaa committed Oct 24, 2024
1 parent 6f074ea commit beb3fc0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/docs/game/miniob-vectordb.md
Original file line number Diff line number Diff line change
@@ -92,7 +92,7 @@ IVF-Flat 是一种常见的高效近似最近邻(Approximate Nearest Neighbor
以图像搜索为例的 IVF-Flat 向量索引工作流程如下:
1. 首先使用 K-Means 算法将所有图像的特征向量分成 1000 个簇。每个簇表示一部分相似的图片。例如,簇 1 可能包含大部分是风景图像的向量,簇 2 可能包含大部分是人物图像的向量,以此类推。对于每个簇,向量索引都维护一个倒排文件索引,存储属于这个簇的所有图像的索引。
比如,簇 1 对应的倒排文件索引可能包括 [image_23, image_45, image_78...],这些是属于簇 1 的图像的索引。
1. 查询过程:用户指定一张新图像进行搜索。首先,将这张图片通过同样的特征提取模型转换成一个高维向量。然后,通过计算这个向量与1000个质心的距离,找到离它最近的几个质心(假设是前5个)。在这几个质心对应的簇中,你进一步进行精确的向量搜索,找到最相似的图像。
2. 查询过程:用户指定一张新图像进行搜索。首先,将这张图片通过同样的特征提取模型转换成一个高维向量。然后,通过计算这个向量与1000个质心的距离,找到离它最近的几个质心(假设是前5个)。在这几个质心对应的簇中,你进一步进行精确的向量搜索,找到最相似的图像。


向量索引语法:
@@ -115,6 +115,7 @@ select column_name1,column_name2, ... from table_name order by vector_distance_f
* 要求limit子句必须是一个整数常量表达式

本题目中只需要支持:

1. 创建 Ivf-Flat 向量索引(本题目不考察 ANN 查询)。
2. 当查询为邻近向量检索且命中向量索引时,需要将 order by + limit 的查询计划改写为通过向量索引进行检索的查询计划。

0 comments on commit beb3fc0

Please sign in to comment.