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

Fast approximate count with predicate

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor - P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: Querying
    • Labels:
      None

      Description

      I've indexed the queried fields, which makes the count works very fast when nobody is updating documents in the collection, but whenever i start more workers, or whenever there is some load, the output is very slow:

      2016-03-09T00:58:22.805+0200 I COMMAND  [conn2451] command squeue.in_auth command: count { count: "in_auth", query: { payload.group: "group1" } } planSummary: COUNT_SCAN { payload.group: 1.0, payload.customer: 1.0 } keyUpdates:0 writeConflicts:0 numYields:8125 reslen:122 locks:{ Global: { acquireCount: { r: 16252 } }, Database: { acquireCount: { r: 8126 } }, Collection: { acquireCount: { r: 8126 } } } protocol:op_query 511ms
      

      Is there any way to make an approximative, but FAST count which ignores the updates? It doesn't matter if it displays a few hundred more or less items in a collection with 10 million docs.

      I'm on a sharded cluster btw (8 rs).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-optimization Backlog - Query Optimization
              Reporter:
              thestick613 Tudor Aursulesei
              Participants:
              Votes:
              7 Vote for this issue
              Watchers:
              19 Start watching this issue

                Dates

                Created:
                Updated: