0

using a MongoDB version 3.6 Replica Set, I am wondering why a query that resulted in no key examination and document examination would result in being slow. For example, I have numerous slow query logs similar to the following (on the primary):

I COMMAND  [conn187790] command dbname.colname command: find { find: "colname", filter: { personId: 1234, createdAt: { $gt: new Date(1610444300000) } }, projection: {}, returnKey: false, showRecordId: false, lsid: { id: UUID("049d5c65-9483-479e-9c84-57e778059560") }, $clusterTime: { clusterTime: Timestamp(1610455000, 78), signature: { hash: BinData(0, 2358064BDB560A37AA2860A3ED9E5B267677A386), keyId: 6880748521151004683 } }, $db: "dbname" } planSummary: IXSCAN { personId: "hashed" } keysExamined:0 docsExamined:0 cursorExhausted:1 numYields:0 nreturned:0 reslen:242 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } protocol:op_msg 325ms

As you can see, my query involves an index that returns nothing, as can be seen in keysExamined:0 docsExamined:0 part. However, it took 325 milliseconds to run.

What factors can result in such behavior? The output of iostat -xm sda is like below:

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          15.74    0.00    6.87    1.25    0.00   76.14

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
sda              2.00 1685.00      0.02     20.30     0.00   162.00   0.00   8.77    2.00    2.81   4.78     8.00    12.34   0.18  29.60

It seems that my machine is not under disk pressure. Also the page fault rate is near to zero and I think is negligible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.