dsz1966 2015-10-15 09:03
浏览 304

使用yii2的MongoDb Slow查询输出

We are using MongoDb with php yii2. There are more than 5000K records in a single collection.

We have following index in MongoDb:

variable1: 1,

variable1: 1, date_time:-1

variable1: 1, variable2:-1

when we execute

db.getCollection('XXX').find({variable1: 1},{ date_time: { $gte: "2015-10-10" } }).sort(date_time : -1) 

it takes more than 5 seconds to display the output. we are using variable2 in another query. I would like to know why the query is taking long 5 second to fetch the result from Database as we are doing query on index fields

Query takes the time to fetch the result for the first time only

When I do the same query second time it gives result in milliseconds

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!