]> git.ipfire.org Git - thirdparty/patchwork.git/commit
models: optimize with_tag_counts using case-when
authorTales da Aparecida <tales.aparecida@redhat.com>
Mon, 21 Oct 2024 12:14:03 +0000 (09:14 -0300)
committerStephen Finucane <stephenfinucane@hotmail.com>
Sun, 7 Jun 2026 15:40:22 +0000 (16:40 +0100)
commit52877f86048b0a9a8f99320ffbe871eae07f95eb
tree126d917c59b3f1a88f2e5c895cf0af3b1ca604e0
parent035ef3261dc4a6dc33aa73e10b3a17ac46b4cf2b
models: optimize with_tag_counts using case-when

Leverage PatchTag index replacing the subquery counter with a JOIN.

The current code is too slow on MySQL, as it doesn't use indexes.
The new approach is more direct and allows proper index usage.

Signed-off-by: Tales da Aparecida <tales.aparecida@redhat.com>
patchwork/models.py