如何快速查询milvus中int类型数据的最大最小值 #41701
Answered
by
yhmo
IeohMingChan
asked this question in
Q&A and General discussion
如何快速查询milvus中int类型数据的最大最小值
#41701
-
请问在milvus中如何快速查询一个collection中某个int类型数据的最大最小值,经测试若遍历所有数据查找最值速度较慢,是否有更快的方式?谢谢 |
Beta Was this translation helpful? Give feedback.
Answered by
yhmo
May 8, 2025
Replies: 2 comments 15 replies
-
应该是需要aggregation功能。 |
Beta Was this translation helpful? Give feedback.
7 replies
-
也许有一个方法可以一试。
然后我用query这么检索,先检索flag > 0的,然后在返回的结果里取出flag最大值,作为下次query的条件。直到查不出任何结果了,就说明那个值是最大的。
注:如果flag字段里有大量重复值,比如超过1000个相同的值,这个query循环有可能会卡住,可以把limit放大点但不能超过16384 |
Beta Was this translation helpful? Give feedback.
8 replies
Answer selected by
IeohMingChan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
也许有一个方法可以一试。
假设我有一张表,有个字段叫"flag",int型,里面的值是未知的,值有可能很大有可能很小。
我给这个flag字段建了个索引。