mirror of https://github.com/milvus-io/milvus.git
fix: Skip load extra indexes for sorted segment pk field (#39389)
Related to #39339 Extra indexes can be ignored for most cases since sorted pk column already provided indexing features --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/39462/head
parent
682b8450e5
commit
45d49df89b
|
@ -167,6 +167,13 @@ ChunkedSegmentSealedImpl::LoadScalarIndex(const LoadIndexInfo& info) {
|
|||
auto field_id = FieldId(info.field_id);
|
||||
auto& field_meta = schema_->operator[](field_id);
|
||||
|
||||
// if segment is pk sorted, user created indexes bring no performance gain but extra memory usage
|
||||
if (is_sorted_by_pk_ && field_id == schema_->get_primary_field_id()) {
|
||||
LOG_INFO(
|
||||
"segment pk sorted, skip user index loading for primary key field");
|
||||
return;
|
||||
}
|
||||
|
||||
auto row_count = info.index->Count();
|
||||
AssertInfo(row_count > 0, "Index count is 0");
|
||||
|
||||
|
|
|
@ -204,6 +204,13 @@ SegmentSealedImpl::LoadScalarIndex(const LoadIndexInfo& info) {
|
|||
auto field_id = FieldId(info.field_id);
|
||||
auto& field_meta = schema_->operator[](field_id);
|
||||
|
||||
// if segment is pk sorted, user created indexes bring no performance gain but extra memory usage
|
||||
if (is_sorted_by_pk_ && field_id == schema_->get_primary_field_id()) {
|
||||
LOG_INFO(
|
||||
"segment pk sorted, skip user index loading for primary key field");
|
||||
return;
|
||||
}
|
||||
|
||||
auto row_count = info.index->Count();
|
||||
AssertInfo(row_count > 0, "Index count is 0");
|
||||
|
||||
|
|
Loading…
Reference in New Issue