I need to count the number of objects of a particular model in my database and display the number with a context processor for the user to view on every page.
Right now I'm simply doing Model.objects.count()
. It works, but as there are now more than 400,000 objects in the db, it has noticeably slowed things down.
I'm running on my development server, so maybe once I push to dedicated servers this won't be a problem, but I'm not sure... I'm worried what will happen once we get into the millions or beyond. Any tips?