Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MongoDB data volume report slow how to do and how to do paging?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

MongoDB data volume report slow how to do and how to do paging? Aiming at this problem, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

MongoDB has no paging mechanism such as relational database. In order to realize the hard coding of paging query, we can define the paging class by implementing the Pageable interface.

The disadvantage of hard coding is that the implementation is too complex and difficult to maintain, and the requirements for report developers are a little high. A simpler way is to use a report tool that supports MongoDB batch fetching, which can solve the problem of querying a large amount of data. You can refer to this: the implementation of massive lists and grouped reports

Here, two asynchronous threads are used. The fetching thread caches the data locally in batches by encapsulating the query cursor returned by API MongoDB, and the rendering thread calculates the number of rows according to the number of pages to the local cache to obtain data display. This can solve the problem of slow page flipping when the page number is large.

Draw a picture and feel it:

② and ③ are two threads respectively, the former thread is responsible for fetching the cache in batches from the MongoDB, and the latter rendering thread is responsible for reading the cache for report rendering.

After doing so, in addition to the report can be asynchronous query, but also support the export of Excel and printing.

About MongoDB data volume report slow how to do and how to do paging? The answer to the question is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report