I have a problem with Django Pagination. When I try to split pages into more than 200,000 entries, the portal’s web loading is very slow (> 10 seconds), and I expect to use about 2 million entries.
I can not find on Stackoverflow or another site a GOOD concrete fix for this problem. Each time the code receives the page, it runs a QuerySet, which processes a very large set of data, which makes it slow.
Does anyone know what can be done? I searched everywhere and could not solve this problem. Below I put the code for pagination. Paper_list: model.object.all (). Filter (category = x) (and now there are about 200 thousand objects (all of them belong to this category).
def paginate_context(paper_list, request, context, source, author, title, term, date): num_papers = len(paper_list) paginator = Paginator(paper_list, 4)
source share