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

Time series queries do not use plan cache when query parameters are changed slightly

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

      A query like

      [
        {"$match":{
      "measurement":"cpu", 
      "tags.hostname":{"$in":["host_18"]}, // H = 1
      	"time":{
      "$gte": new Date("2016-01-13T21:49:27.243Z"), // T = 1h
      "$lt": new Date("2016-01-13T22:49:27.243Z")}, 
        }},
        {"$group":{
      "_id":{"$dateTrunc":{"date":"$time","unit":"minute"}},
      	"max_usage_user":{"$max":"$usage_user"} // M = 1
        }},
        {"$sort":{"_id":1}}
      ]
      

      will use the plan cache when the same query is executed over and over. However, if you slightly adjust the parameters in the $match, it will not. This means that in practice most TS queries will have to multi-plan again each time.

      CC parker.felix@mongodb.com who discovered the bug.

            Assignee:
            ian.boros@mongodb.com Ian Boros
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: