[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: File out.svg    
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: SERVER-66521 allow partial optimization of expressions
Branch: master
https://github.com/mongodb/mongo/commit/8c46e933d477be2424eb1aa833ec966e761b0205

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