Super-long planningTimeMicros value

This bit from a “slow query” log message sort of says it all:

"planningTimeMicros":2114562

That’s 2.1 seconds of “planning time”!

Does anyone know what might be causing this behavior?

1 Like

How about

“replanReason”: “cached plan was less efficient than expected: expected trial execution to take 7 reads but it took at least 71 reads”,
“planningTimeMicros”: 48362225,

Here is another:

"planningTimeMicros": 34581243,
  "keysExamined": 0,
  "docsExamined": 0,
  "cursorExhausted": true,
  "numYields": 1864,
  "nreturned": 0,

34 seconds of planning to return 0 results.

These are the issues with the huge number of indexes.

My 2c here is, review the indexStats output, remove the unwanted/unused/repeated indexes.

I would recommend you to hide the index before dropping them.

Thanks,
Darshan