I have a model with a lot of entries (more than 12,513,262) and they are supposed to increase exponentially. But the problem is due to this large no. entries querying is taking a lot of time is there a way to increase performance using indices etc.
My query is like this:
MyModel.objects.all().order_by('-timestamp')[0:50]
and its taking a lot of time to execute.