[Feature]: pgsql向量数据库只有预设维度的hnsw索引,预设维度以外的向量需要手动建索引
Author: Spectacular262408Created Sep 16, 2026Updated Sep 17, 2026
Labelsenhancement
Affected Component
Vector Database
Problem Description
团队使用了自部署的embeding模型(2560维度),在知识库数量级增大时,发现检索耗时明显上升。通过校验postgres的embeddings表 以及 weknora源码中的sql文件,发现只预设了3584、798、1024维度的索引,于是手动去建立维度为2560的hnsw索引。
Proposed Solution
希望官方能增加“自动为其他维度向量建立索引的机制” 设想是sql建表时设置触发器,以及增加一张新表记录维度和是否有索引(待办表)。当新维度的向量进embeddings表时,触发器在新表中进行记录,再加一个pg_cron定时扫描待办表,并执行建索引的命令,以此实现异步的自动建索引的机制。或官方综合考虑后,采取更优的实践方式。
Alternatives
No response
Impact
Many users would benefit
Use Case
当用户使用不同的embedding模型时,都可能会遇到缺少索引,导致向量检索耗时随数据量陡增的情况。
Additional Information
No response
Confirmation
- I have searched existing issues and confirmed this is a new request
- I understand this request may need discussion and evaluation
Source: Tencent/WeKnora