[SERVER-66521] Optimize parseTimeUnit() for date expressions Created: 17/May/22 Updated: 29/Oct/23 Resolved: 28/Jul/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.1.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Rui Liu | Assignee: | Alberto Massari |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Backwards Compatibility: | Fully Compatible |
| Sprint: | QE 2022-07-11, QE 2022-07-25, QE 2022-08-08 |
| Participants: |
| Description |
|
The parseTimeUnit() is an expensive operation, which is on the hot path for ExpressionDateDiff and ExpressionDateTrunc. In most queries the time unit is specified as a constant in the query. So the parseTimeUnit() can be invoked during the Expression::optimize() and stored as a member variable. Additionally, the parseTimeUnit() does an extra lookup in the timeUnitNameToTimeUnitMap hash map, which can be avoided. |
| Comments |
| Comment by Githook User [ 28/Jul/22 ] |
|
Author: {'name': 'Alberto Massari', 'email': 'alberto.massari@mongodb.com', 'username': 'albymassari'}Message: |