[SERVER-75098] Investigate reducing cost of cached plan preparation Created: 21/Mar/23  Updated: 05/Feb/24  Resolved: 05/Feb/24

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 8.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Anna Wawrzyniak Assignee: Anna Wawrzyniak
Resolution: Done Votes: 0
Labels: perf-tiger
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File patch_perf.svg     File sbe_perf.svg    
Issue Links:
Related
Sprint: QE 2023-05-15, QE 2023-05-29, QE 2023-06-12, QE 2023-06-26, QE 2023-07-10, QE 2023-07-24, QE 2023-08-07, QE 2023-08-21, QE 2023-09-04, QE 2023-09-18, QE 2023-10-02, QE 2023-10-16, QE 2023-10-30, QE 2023-11-13, QE 2023-11-27, QE 2023-12-11, QE 2023-12-25, QE 2024-01-08, QE 2024-01-22, QE 2024-02-05, QE 2024-02-19
Participants:

 Description   

Currently preparing cached plans involve:

  • cloning of PlanStage tree, including all their arguments, EExpressions, etc.
  • compiling EExpressions
  • preparing and linking slots accessors.

Investigate if is is possible to reduce that cost, for example by sharing immutable structures (like EExpressions, slot vectors, etc) and compilation results. And if so, estimate the possible performance impact.



 Comments   
Comment by Anna Wawrzyniak [ 28/Mar/23 ]

POC for EExpression compilation caching:
https://github.com/10gen/mongo/compare/master...aa028371d240af750c9de8368714395ef35a3ee7

This produces around 3% improvement for FindProjectionDottedField, that use simple queries like  {op: "find", query: {}, filter: {"x.y": 1, _id: 0}}

 

POC for EExpression compilation caching + no PlanStage cloning (cloning replaced by makeExecutable, and the entire PlanStage is shared:
https://github.com/10gen/mongo/compare/anna.wawrzyniak/sbe_expression_caching?expand=1

This produces additional 1.4% improvement for the same query.

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