I have a database with about 3 million records, and I want to retrieve these records to be displayed by a Django web app. However, attempting to pass these via Model.objects.all() passed by templating a javascript variable causes my Apache server to crash. So, I created a Django REST Framework endpoint which returns these records. But, this returns a 504 Gateway Timeout when I make the GET request.
How can I retrieve all these records to display in my Django app? I would like to avoid paging or filtering.
2
Answers
I think you should use pagination and cashing in your Django app this will improve app performance and solving your problem.
Why you don’t wanna use pagination? You can’t show all data at once then what’s the point of getting it all at once?