Limit = 1 = 1ms, Limit > 1 = 150ms (mongo-melt-down)

前端 未结 1 1062

Using MongoDB Native Driver, here\'s the query:

  mo.post.find({_us:_us, utc:{$lte:utc}},{
    fields:{geo:0, bin:0, flg:0, mod:0, edt:0},
    hint:{_us:1, utc:-         


        
1条回答
  •  鱼传尺愫
    2021-01-22 13:47

    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?

    0 讨论(0)
提交回复
热议问题