Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-60174

Add fast-path for _id updates on collections with clustered index

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution

      The IDHackStage that by-pass instantiating a full query executor with query planning etc requires a regular index.

      https://github.com/mongodb/mongo/blob/92738c5fa0e8169299e5393e88159b8cbb9559ca/src/mongo/db/query/get_executor.cpp#L1513-L1530

      Time-series bucket collections that use a clustered index thus need to use the regular path that is slower than the above.

      Doing profiling during tsbs we spend around 5% here:

      --5.43%--mongo::getExecutorUpdate(mongo::OpDebug*, mongo::CollectionPtr const*, mongo::ParsedUpdate*, boost::optional<mongo::explain::VerbosityEnum>, std::function<unsigned long (mongo::BSONObj const&)>&&)
                |          
                |--2.97%--mongo::(anonymous namespace)::PrepareExecutionHelper<std::unique_ptr<mongo::PlanStage, std::default_delete<mongo::PlanStage> >, mongo::(anonymous namespace)::ClassicPrepareExecutionResult>::prepare()
                |          |          
                |           --1.61%--mongo::QueryPlanner::plan(mongo::CanonicalQuery const&, mongo::QueryPlannerParams const&)
                |                     |          
                |                      --1.44%--mongo::QueryPlanner::planForMultiPlanner(mongo::CanonicalQuery const&, mongo::QueryPlannerParams const&)
                |                                |          
                |                                 --0.72%--mongo::buildCollscanSoln(mongo::CanonicalQuery const&, bool, mongo::QueryPlannerParams const&)
                |          
                 --1.57%--mongo::ParsedUpdate::parseQueryToCQ()
                           |          
                            --1.28%--mongo::CanonicalQuery::canonicalize(mongo::OperationContext*, std::unique_ptr<mongo::FindCommandRequest, std::default_delete<mongo::FindCommandRequest> >, bool, boost::intrusive_ptr<mongo::ExpressionContext> const&, mongo::ExtensionsCallback const&, unsigned long long, mongo::ProjectionPolicies const&, std::vector<std::unique_ptr<mongo::InnerPipelineStageInterface, std::default_delete<mongo::InnerPipelineStageInterface> >, std::allocator<std::unique_ptr<mongo::InnerPipelineStageInterface, std::default_delete<mongo::InnerPipelineStageInterface> > > >)
                                      |          
                                       --0.77%--mongo::MatchExpressionParser::parse(mongo::BSONObj const&, boost::intrusive_ptr<mongo::ExpressionContext> const&, mongo::ExtensionsCallback const&, unsigned long long)
                                                 |          
                                                  --0.62%--mongo::(anonymous namespace)::parse(mongo::BSONObj const&, boost::intrusive_ptr<mongo::ExpressionContext> const&, mongo::ExtensionsCallback const*, unsigned long long, mongo::DocumentParseLevel)
                
      

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            henrik.edin@mongodb.com Henrik Edin
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: