]> 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 <stephen@that.guru>
Wed, 10 Jun 2026 12:44:57 +0000 (13:44 +0100)
commit7074e4b75fcbaa08c5a203a45c9a56a5ecb7a890
treec3c7433c97a880bb3a07780f2f321395a343696f
parente5aef739f95c981e548b1f8f65e142fe18a44d8a
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>
(cherry picked from commit 52877f86048b0a9a8f99320ffbe871eae07f95eb)
patchwork/models.py