.explain on query with $gt never finish

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: Critical - P2
    • None
    • Affects Version/s: 2.6.6
    • Component/s: Index Maintenance, Querying
    • None
    • ALL
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      We have a collection with approximately 5 million records.
      One of the fields is called last_updated, it's a date field and we created an index for it.

      When we query the collection with

      {last_updated: {$gt: new Date(2012,5,1)}}
      

      we get the cursor back very quickly. Similar with a count.

      When we add a .explain() to the query, it never completes (we waited for 30 minutes) and our disks go beserk with read activity.

      When we change the query to

      {last_updated: new Date(2012,5,1)}
      

      and run it with .explain(), it behaves as expected.

      As an aside:

      We had issues creating that index in production, where we've got replica sets and sharding (and 10 mil records). We pulled some of our data into a standalone instance in order to play around with the index without affecting production. When we had issues in production, it had similar symptoms (disks would be slammed with read activity). We didn't run .explain() to trigger our production issue, but it seems spookily similar to this issue. Just deleting the index would cause the system to operate normally again.

        1. explained.txt
          9 kB
        2. query_plan.json
          2 kB

            Assignee:
            Ramon Fernandez Marina
            Reporter:
            Hendrik Swanepoel
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: