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

Add planSummary information to count command

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.2, 2.7.2
    • Affects Version/s: 2.6.0
    • Component/s: Querying
    • Labels:
      None
    • Fully Compatible

      Issue Status as of Jun 9, 2014

      ISSUE SUMMARY
      When a count() operation takes longer than the specified value of slowms (100ms by default), the corresponding message in the log file contains information about the plan summary used in the query. Here are two sample log lines:

      2014-06-09T17:30:10.759-0400 [conn4] command test.$cmd command: count { count: "foo", query: { x: { $gt: 12345.0 } }, fields: {} } planSummary: COLLSCAN keyUpdates:0 numYields:287 locks(micros) r:253415 reslen:48 154ms
      2014-06-09T17:30:58.876-0400 [conn4] command test.$cmd command: count { count: "foo", query: { x: { $gt: 12345.0 } }, fields: {} } planSummary: COUNT { x: 1.0 } keyUpdates:0 numYields:165 locks(micros) r:133823 reslen:48 78ms
      

      The first line of the log above shows a slow count() operation doing a collection scan:

      planSummary: COLLSCAN
      

      while the second shows a slow count() operation using the index {x: 1}:

      planSummary: COUNT { x: 1.0 }
      

      RELEASE VERSION
      This improvement is included in the MongoDB 2.6.2 production release.

      Original description

      planSummary information is very useful in determining index usage when mongod prints slow operations to the logs. Please add to count command logging which is not present in 2.6.0.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            james.wahlin@mongodb.com James Wahlin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: