Commit e83e0f7
authored
PERF: Improve performance of DiscourseTagging.hidden_tag_names (#36636)
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 a11f86c commit e83e0f7
1 file changed
+15
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
640 | 640 | | |
641 | 641 | | |
642 | 642 | | |
643 | | - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
644 | 658 | | |
645 | 659 | | |
646 | 660 | | |
| |||
0 commit comments