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

Large $in queries are several orders of magnitude slower

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Blocker - P1 Blocker - P1
    • 2.6.0-rc2
    • Affects Version/s: 2.6.0-rc1
    • Component/s: Querying
    • Labels:
    • ALL
    • Hide

      build/run attached cpp file.

      build/run attached cpp file.

      Running the attached client as follows:

      ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27249 100000
      Total query time in miliseconds: 389
      Doc count: 100000
      ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27261 10000
      Total query time in miliseconds: 2103
      ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27261 100000
      Total query time in miliseconds: 380121
      Doc count: 100000

      The last execution never returns a result, and the client is blocked in the call to DBClientCursor::more(). Note that the server logs the slow query at ~230ms on my machine, but the process continues to consume 100% cpu for 380 seconds.

        1. in_query_100_unindexed.svg
          117 kB
        2. in_query.cpp
          2 kB
        3. in_query.pdf
          8 kB
        4. in_query.svg
          42 kB
        5. server13100.js
          0.8 kB

            benety.goh@mongodb.com Benety Goh
            benjamin.becker Ben Becker
            0 Vote for this issue
            12 Start watching this issue