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

Log queries with high ratio of scanned / returned

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • None
    • None
    • Logging
    • None

    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

              backlog-server-query Backlog - Query Team (Inactive)
              tomer.yakir@mongodb.com Tomer Yakir
              Votes:
              27 Vote for this issue
              Watchers:
              45 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: