[SERVER-61185] Use prefix_search for unique index lookup Created: 02/Nov/21  Updated: 30/Jan/24  Resolved: 18/Jan/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.3.0, 4.4.18, 5.0.14

Type: Improvement Priority: Major - P3
Reporter: Louis Williams Assignee: Louis Williams
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
depends on WT-7912 Fix prefix search near optimisation t... Closed
is depended on by WT-8150 Poor search near performance if a lot... Closed
Duplicate
is duplicated by SERVER-50749 Re-loading is slow with py-tpcc Closed
Related
related to SERVER-65054 Avoid slow insert batches blocking re... Open
related to SERVER-56509 Wrap unique index insertion _keyExist... Closed
is related to SERVER-67350 stalling during concurrent insertMany... Closed
is related to SERVER-65527 Use range bounded cursors in place of... Closed
is related to SERVER-85371 [4.4] Enable wiredTigerPrefixSearchFo... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v5.0, v4.4
Sprint: Execution Team 2021-12-27, Execution Team 2022-01-10, Execution Team 2022-01-24
Participants:
Case:
Linked BF Score: 15

 Description   

Re-implement SERVER-56509. This improves the performance of inserts into uniques indexes.



 Comments   
Comment by Louis Williams [ 13/Oct/22 ]

This change improves the performance of inserting documents into collections with unique indexes. The change was not backported uniformly to all branches.

For 4.4:
We have disabled the optimized behavior by default, but it can be enabled with a setParameter "wiredTigerPrefixSearchForUniqueIndexes". This was done in an attempt to prevent making significant behavioral changes on a more stable branch.

For 5.0:
We have enabled the optimized behavior by default, but it can be disabled with a setParameter "wiredTigerPrefixSearchForUniqueIndexes". This may be done for users who do not want to expose themselves to this behavior on a stable branch.

For all newer versions, this behavior is enabled by default and cannot be disabled.

Comment by Githook User [ 13/Oct/22 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-61185 Use WT prefix_search for unique index lookups when enabled by a server parameter

(cherry picked from commits f18bb1e1c2d7bedeb3c08964e6a65bcc794e2a2a and 5923aa87d869a12d40ce605f3aee69d47314aabf)
(cherry picked from commit 61c9768820795fd164a8749c090e702eb632329b)
Branch: v4.4
https://github.com/mongodb/mongo/commit/17f21f74c517b8434ae72cf159918ef413eadf72

Comment by Githook User [ 28/Sep/22 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-61185 Use WT prefix_search for unique index lookups

(cherry picked from commits f18bb1e1c2d7bedeb3c08964e6a65bcc794e2a2a and 5923aa87d869a12d40ce605f3aee69d47314aabf)
Branch: v5.0
https://github.com/mongodb/mongo/commit/61c9768820795fd164a8749c090e702eb632329b

Comment by Githook User [ 13/Jan/22 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-61185 Use prefix_search instead of prefix_key for unique index lookups
Branch: master
https://github.com/mongodb/mongo/commit/5923aa87d869a12d40ce605f3aee69d47314aabf

Comment by Louis Williams [ 13/Jan/22 ]

etienne.petrel, wow, thanks for identifying my mistake! I will add you to the next code review.

Comment by Etienne Petrel [ 13/Jan/22 ]

alex.podelko, I agree with Monica, we don't expect any perf regression.

I had a look at the code changes that should re-enable the prefix search option. However we need to be careful as I think the changes are not correct (louis.williams), the option is called prefix_search and not prefix_key, see the definition here. Please make sure the option is enabled with the correct name, an example can be seen here. Let us know if this helps.

Comment by Alex Podelko (Inactive) [ 12/Jan/22 ]

monica.ng I am not aware about a regression - but that fix was supposed to fix multiple regressions: BF-22130 BF-23346 BF-22529. Doesn't look like it did. chenhao.qu etienne.petrel luke.pearson jim.oleary

Comment by Monica Ng [ 12/Jan/22 ]

I don't expect it to have a performance impact but I agree with Chenhao, if there is a regression we can have a closer look into it.

Comment by Chenhao Qu [ 12/Jan/22 ]

monica.ng etienne.petrel jie.chen luke.pearson Do you guys expect WT-7912 to have a performance impact? alex.podelko If there is a regression, please create a wiredtiger ticket and we will look into it.

Comment by Chenhao Qu [ 12/Jan/22 ]

louis.williams I expect no change for the performance.

Comment by Louis Williams [ 12/Jan/22 ]

alex.podelko, the re-enabled prefix_key feature includes correctness fixes from WT-7912. monica.ng, chenhao.qu, would either of you expect WT-7912 have different performance characteristics as compared to the original implementation, WT-7264?

Comment by Githook User [ 11/Jan/22 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-61185 Use WT prefix_key search for unique index lookups
Branch: master
https://github.com/mongodb/mongo/commit/f18bb1e1c2d7bedeb3c08964e6a65bcc794e2a2a

Generated at Thu Feb 08 05:51:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.