UPDATE: I’ve re-written and open-sourced a
better way of doing the below as part of my library
django-mysql. The docs there on approximate counting are
just as good a read as the below, and you can pip
install the solution.
I was looking through the MySQL slow_log for YPlan and discovered that there were a lot of
SELECT COUNT(*) queries going on, which take a long
time because they require a full table scan. These were coming
from the Django admin, which displays the total count on
every page.
“Why is …
[Read more]