MongoDB Native Node Driver: Explain is Broken?

前端 未结 2 810
清酒与你
清酒与你 2021-01-23 18:13

I can\'t get a proper explain using the native mongodb driver for Node.js. When I use the mongo shell, everything is fine. Is my syntax wrong? Anything else I could be doing wro

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-23 18:35

    Looks like a 2.0.x issue. Already submitted ticket.

    Seems to be a problem with the 2.0.x driver: here's a thread...

    I just ran the exact same query with 2.0.x and 1.4.x. When Limit = 1, both perform fast ~1ms. When Limit = 2, the 1.4.x version stays around 1ms but the 2.0.x version jumps to 25ms. So, it's not just an issue with the explain output - that's just a symptom of the problem.

    On Thursday, January 8, 2015 9:04:05 AM UTC-8, Joshua Abrams wrote: Interesting... exact same query using 1.4.x yields a proper explain where n = 2 (and so on). Could this be affecting performance? When I run a query where Limit = 1 it's fast (as expected) but when Limit = 2 it's 100x slower...

    On Thursday, January 8, 2015 8:52:28 AM UTC-8, christkv wrote: not really. My suggestion is to make a minimal reproducible test case (code and data) and open a ticket on jira.mongodb.com. kind of hard to know what could be happening. it's unlikely to be the driver but one never knows. try with the 1.4.x branch aswell just to at least rule out that it's a 2.0.x branch issue.

    On Thursday, January 8, 2015 5:47:45 PM UTC+1, Joshua Abrams wrote: Just checked and I'm using 2.0.12 of the driver. Any other thoughts?

    On Thursday, January 8, 2015 8:23:16 AM UTC-8, christkv wrote: explain is just retuning all the results in the driver instead of partial results. thus you get the plan. One thing that comes to mind might be that you are on a driver earlier than 1.4.19 that had an error where batchSize was set to 1.

    On Thursday, January 8, 2015 5:01:42 PM UTC+1, Joshua Abrams wrote: I've been having a suite of performance issues lately with the driver. Limit = 1 = 1ms, Limit > 1 = 150ms (mongo-melt-down)

    Not sure what the root cause it - and it's impossible to debug when I can't get a proper explain: MongoDB Native Node Driver: Explain is Broken?

提交回复
热议问题