我的q_development.users表有超過1,000,000條記錄。奇怪的是,我的mongodb在這個集合上記錄了一些耗時的項目,而沒有明確記錄查詢的內容。 MongoDB甚至不記錄這些查詢的ntoreturn
或ntoskip
。這是非常可疑的,因爲reslen
都是一樣的。日誌如下所示可疑的mongodb.log項目
Fri May 25 00:01:00 [conn56429] query q_development.users nscanned:1207786 reslen:20 2390ms
Fri May 25 00:09:09 [conn55528] query q_development.users nscanned:1207799 reslen:20 2623ms
Fri May 25 00:11:11 [conn55529] query q_development.users nscanned:1207800 reslen:20 2660ms
Fri May 25 00:28:56 [conn55586] query q_development.users nscanned:1207823 reslen:20 2777ms
Fri May 25 00:46:45 [conn55529] query q_development.users nscanned:1207850 reslen:20 4218ms
Fri May 25 00:47:46 [conn56169] query q_development.users nscanned:1207851 reslen:20 2392ms
Fri May 25 01:30:49 [conn57141] query q_development.users nscanned:1207901 reslen:20 4289ms
你知道什麼樣的查詢可以生成這樣的mongodb.log項嗎?非常感謝你!
看起來像全掃描。誰知道你在那裏比你做得更好? –