readthedocs.org
850ec30c - Dashboard: optimize projects queryset (constant number of queries) (#12385)

Commit
182 days ago
Dashboard: optimize projects queryset (constant number of queries) (#12385) This is on top of https://github.com/readthedocs/readthedocs.org/pull/12383/ as another PR in case we see a regression in performance, it would be easier to just revert this change. Instead of pre-fetching, we annotate, so we can use exist instead of fetching the query. This allows to just make one query. But this does add some extra complexity to the query itself, which is less overhead than doing a prefetch over the queryset itself, but the pagination package we are using calls .count(), and django includes the annotation by default... which makes that query slower as well... but testing in production shows faster results still.
Author
Parents
Loading