Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: Skip loading pk index for sorted segment in loader #39437

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions internal/querynodev2/segments/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,19 @@
return err
}

// // if segment is pk sorted, user created indexes bring no performance gain but extra memory usage
if s.IsSorted() && fieldSchema.GetIsPrimaryKey() {
log.Info("skip loading index for pk field in sorted segment")
// set field index, preventing repeated loading index task
s.fieldIndexes.Insert(indexInfo.GetFieldID(), &IndexedFieldInfo{
FieldBinlog: &datapb.FieldBinlog{
FieldID: indexInfo.GetFieldID(),
},
IndexInfo: indexInfo,
IsLoaded: true,
})
}

Check warning on line 1035 in internal/querynodev2/segments/segment.go

View check run for this annotation

Codecov / codecov/patch

internal/querynodev2/segments/segment.go#L1026-L1035

Added lines #L1026 - L1035 were not covered by tests

return s.innerLoadIndex(ctx, fieldSchema, indexInfo, tr, fieldType)
}

Expand Down
Loading