django-mysql
django-mysql copied to clipboard
approx_count can go further
The approx_count function can be used to count QuerySets other than the basic full-table ones it accepts at current. For example, you can get a reliable(-ish) approximate count on an index range, such as id BETWEEN 1 AND 500 (with id = primary key). This would make it much more useful too.
What might be involved with implementing this?
We use approx count in some places in django admin so any improvements/extensions would be great to have.
The idea is to expand can_approx_count to cover other situations, without hitting false positives.
Looking again at it, I'm not sure how feasible it is, given the information we have in Django about the database layout and the complexity of introspecting every possible modification to a QuerySet.
I think this is probably too hard.