Commit 5b19143
authored
PERF: Improve performance of DiscourseTagging.hidden_tag_names (stable backport) (#36638)
This backports #36636 to stable.
Improve performance of `DiscourseTagging.hidden_tag_names` by using its
own query.
Previously it added `where.not(id: ` to the query from
`DiscourseTagging.visible_tags`. This simplifies the hidden_tag_names
query by just directly running the inverse query, to find names of tags
which have at least one TagGroupPermission but do not have any for
permitted tag groups.
This query gets run every time tags are displayed on a page, and the
goal here is to improve performance in the case tracked in internal
topic /t/168944. On that customer's site, this reduces the query time
from ~11ms to ~5ms.1 parent f012da0 commit 5b19143
1 file changed
+15
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
647 | | - | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
648 | 662 | | |
649 | 663 | | |
650 | 664 | | |
| |||
0 commit comments