84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
翻页是采用limit 加上find 第一页的最后一条的_id 来取出第二页的内容
但是就算把索引都载入内存后 翻过两千万文档后每次翻页都耗时十秒以上
请问还有什么翻页快速的方法么
拜谢 感激不尽
First get the first id of the current page, and then use the following to get all the data of the next page:
db.collection.find({_id: {$gt: current_id}}). skip(page_size). limit(page_size). sort({_id: 1});
I have more than 6 million pieces of data, and it is very fast to use this method. If this is the case for you and it still takes more than ten seconds, it may be that your query conditions are not indexed.
Use skip加limit to turn pages
skip
limit
First get the first id of the current page, and then use the following to get all the data of the next page:
I have more than 6 million pieces of data, and it is very fast to use this method.
If this is the case for you and it still takes more than ten seconds, it may be that your query conditions are not indexed.
Useskip
加limit
to turn pages