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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 关于大棚监测的pcb板设计
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入