[SERVER-75506] Cache $lookup inner query plans with single solution Created: 30/Mar/23  Updated: 29/Oct/23  Resolved: 11/Apr/23

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

Type: Improvement Priority: Major - P3
Reporter: Matt Boros Assignee: Matt Boros
Resolution: Fixed Votes: 0
Labels: perf-70-blocker
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
Related
related to SERVER-76684 Cached plans from inner $lookup singl... Open
Backwards Compatibility: Fully Compatible
Sprint: QO 2023-04-03, QO 2023-04-17
Participants:
Linked BF Score: 35

 Description   

For $lookup inner queries that have only one query solution, we do not multiplan and therefore do not cache. However caching these plans is beneficial to performance, we are seeing an 8% overall improvement in TPCH Q11 throughput and 3% improvement in TPCH Q7.

To avoid affecting a large class of queries, we should only force the cache when the query comes from a lookup. We can set a variable via the ExpressionContext to communicate this flag.

Slack discussion



 Comments   
Comment by Githook User [ 11/Apr/23 ]

Author:

{'name': 'Matt Boros', 'email': 'matt.boros@mongodb.com', 'username': 'mattBoros'}

Message: SERVER-75506 Cache $lookup inner query plans with single solution
Branch: master
https://github.com/mongodb/mongo/commit/4a2fe90f565894a439ccb70713892311a3a0ee1d

Comment by Matt Boros [ 05/Apr/23 ]

Here's a summary of the performance changes for TPC-H queries affected by this ticket. I will also look into non-TPCH benchmarks for $lookup.

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