File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2913,7 +2913,6 @@ int ObDASHNSWScanIter::post_query_vid_with_filter(
29132913 } else if (need_cnt_next > 0 ) {
29142914 float need_ratio = static_cast <float >(need_cnt_next) / static_cast <float >(added_cnt);
29152915 float select_ratio = static_cast <float >(added_cnt) / static_cast <float >(unfiltered_vid_cnt);
2916- int need_res_cnt = select_ratio > 0 ? static_cast <int64_t >(std::ceil (need_cnt_next / select_ratio)) : need_cnt_next;
29172916 uint32_t new_limit = 0 ;
29182917 int64_t new_ef = old_ef;
29192918 if (added_cnt == 0 ) {
@@ -2923,7 +2922,8 @@ int ObDASHNSWScanIter::post_query_vid_with_filter(
29232922 new_ef = new_ef > VSAG_MAX_EF_SEARCH ? VSAG_MAX_EF_SEARCH : new_ef;
29242923 query_cond_.is_last_search_ = false ;
29252924 } else {
2926- int need_res_cnt = static_cast <int64_t >(std::ceil (need_cnt_next / select_ratio));
2925+ int64_t need_res_cnt = OB_MIN (static_cast <int64_t >(std::ceil (need_cnt_next / select_ratio)),
2926+ query_cond_.query_limit_ * FIXED_MAGNIFICATION_RATIO_EACH_ITERATIVE );
29272927 if (can_be_last_search (old_ef, need_cnt_next, select_ratio)) {
29282928 new_limit = old_ef;
29292929 query_cond_.is_last_search_ = true ;
Original file line number Diff line number Diff line change @@ -497,6 +497,7 @@ class ObDASHNSWScanIter : public ObDASIter
497497 static const uint64_t MAX_VSAG_QUERY_RES_SIZE = 16384 ;
498498 static const uint64_t VSAG_MAX_EF_SEARCH = 160000 ;
499499 static constexpr double FIXED_MAGNIFICATION_RATIO = 2.0 ;
500+ static constexpr double FIXED_MAGNIFICATION_RATIO_EACH_ITERATIVE = 10.0 ;
500501 static constexpr double SPARSE_FIXED_MAGNIFICATION_RATIO = 50.0 ;
501502 static constexpr double ITER_CONSIDER_LAST_SEARCH_SELETIVITY = 0.05 ;
502503 static const uint64_t MAX_OPTIMIZE_BATCH_COUNT = 16 ;
You can’t perform that action at this time.
0 commit comments