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

XMLWordPrintableJSON

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

      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
              Reporter:
              Ian Boros
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: