Commit 850ec30
authored
Dashboard: optimize projects queryset (constant number of queries) (#12385)
This is on top of
#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.1 parent ac69118 commit 850ec30
File tree
3 files changed
+16
-7
lines changed- readthedocs
- projects
- rtd_tests/tests
3 files changed
+16
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
980 | 980 | | |
981 | 981 | | |
982 | 982 | | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | | - | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
987 | 987 | | |
988 | 988 | | |
989 | 989 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
146 | 148 | | |
147 | 149 | | |
148 | 150 | | |
149 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
150 | 158 | | |
151 | 159 | | |
152 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
| 382 | + | |
| 383 | + | |
383 | 384 | | |
384 | 385 | | |
385 | 386 | | |
| |||
398 | 399 | | |
399 | 400 | | |
400 | 401 | | |
401 | | - | |
| 402 | + | |
402 | 403 | | |
403 | 404 | | |
404 | 405 | | |
| |||
0 commit comments