Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-5150

PlanCache.listQueryShapes() need clearer explanation

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • mongodb-3.0
    • manual

    Description

      The doc on this page

      http://docs.mongodb.org/manual/reference/method/PlanCache.listQueryShapes/#PlanCache.listQueryShapes
      

      says this:

      Example
       
      The following returns the query shapes that have cached plans for the orders collection:
       
      db.orders.getPlanCache().listQueryShapes()
      The method returns an array of the query shapes currently in the cache. In the example, the orders collection had cached query plans associated with the following shapes:
       
      [
        {
          "query" : { "qty" : { "$gt" : 10 } },
          "sort" : { "ord_date" : 1 },
      ...
      

      "Blindly" trying the example may not yield any plans on your test collection because not all query plans are cached by the engine. The language

      The following returns the query shapes that have cached plans for the orders collection:
      

      is therefore not technically wrong but it is very easy to misinterpret. We should add one of those yellow "Important" boxes with an explanation that not all queries automatically place at least one plan in the cache.

      Attachments

        Activity

          People

            allison.moore@mongodb.com Allison Reinheimer Moore
            buzz.moschetti Buzz Moschetti
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              8 years, 1 week ago