-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
SERVER-84667:index check, avoid create duplicate btree indexes, Avoid affecting performance #1588
base: master
Are you sure you want to change the base?
SERVER-84667:index check, avoid create duplicate btree indexes, Avoid affecting performance #1588
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my inline comments
//For example: | ||
// Add two indexes: db.collection.createIndex({a:1}) and db.collection.createIndex({a:11}) | ||
// The two indexes are actually the same, One of them is a useless index | ||
auto dealIndexKeyPattern = [&](const BSONObj& indexKeyPattern) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please capture what is needed, in this case "this". Change [&] to [this].
A better name for dealIndexKeyPattern is canonizeIndexKeyPattern.
@mongodt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mongo default language is c++ ?
btree index check, avoid create duplicate btree indexes, Avoid affecting performance
btree index check, avoid create duplicate btree indexes, Avoid affecting performance by the deplicate index.
for example:
add two index: db.collection.createIndex({a:1}) and db.collection.createIndex({a:11})
the tow index are actually the same, One of them is a useless index, but it can affect the insert performance.
In addition, They also affecting query performance because both are candidate indexes. This increases storage consts.