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

Log queries with high ratio of scanned / returned

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Logging
    • Labels:
      None
    • Case:

      Description

      We should log queries with high ratio of scanned / returned regardless of their execution time to help find inefficient queries.


      This is now possible with SERVER-49102 fixed. Each database can be configured with a filter (a query predicate) that controls which operations are logged.

      For example, this filter will log queries where the ratio of index keys examined to documents returned is greater than 100:

      db.setProfilingLevel(0, {filter:
          {$expr: {$gt: [
              "$keysExamined",
              {$multiply: ["$nreturned", 100]},
          ]}}
      })
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-query Backlog - Query Team (Inactive)
              Reporter:
              tomer.yakir Tomer Yakir
              Participants:
              Votes:
              27 Vote for this issue
              Watchers:
              44 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: