[SERVER-65005] Avoid $lookup in time-series last point optimization Created: 28/Mar/22 Updated: 29/Oct/23 Resolved: 07/Apr/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.0.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Steve Tarzia | Assignee: | Alya Berciu |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Participants: | |||||||||||||
| Linked BF Score: | 135 | ||||||||||||
| Description |
|
Ad-hoc tests suggest that we can improve performance of last point queries by changing our query rewrite. Consider the following user-specified query:
which we usually would rewrite to:
We actually can get the same results with slightly better runtime by avoiding the $lookup using the following alternative rewrite:
This optimization was suggested by a comment from david.percy on the tech design for PM-2330: The tweak described above improved runtime from 210ms to 140ms in my tests with a debug build on the following data set: https://gist.github.com/starzia/9d1f8a25a2e2e2124b78e2da71159602 However, genny tests showed every larger larger latency improvements – more than a 7x speedup |
| Comments |
| Comment by Githook User [ 07/Apr/22 ] |
|
Author: {'name': 'Alya Berciu', 'email': 'alya.berciu@mongodb.com', 'username': 'alyacb'}Message: |
| Comment by Steve Tarzia [ 30/Mar/22 ] |
|
Actually, alya.berciu saw more than 80% improvement with this change on genny tests, so we are bumping the priority of this ticket and moving into the active Last Point project. |