Files
fleet/changes/4890-optimize-label-query
T
Juan Fernandez f19c9a6696 Optimize ListLabels host-count query
Fixes #4890

* Optimized listing labels query by refactoring correlated subquery.
* Optimized aggregate that counts host's labels to executed once, and
skip the join to hosts entirely when the team filter allows all hosts.
2026-06-05 12:29:30 -04:00

2 lines
242 B
Plaintext

- Improved the performance of listing labels with host counts by aggregating membership counts in a single pass instead of a per-label subquery, and skipping the unnecessary join to the hosts table when the requesting user can see all hosts.