Skip to content

Commit 9b0d2a2

Browse files
committed
RHINENG-22130: speedup florist query
1 parent 4da7772 commit 9b0d2a2

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

deploy/clowdapp.yaml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -573,15 +573,17 @@ objects:
573573
chunksize: ${{FLOORIST_CHUNKSIZE}}
574574
query: >-
575575
SELECT ra.name AS rh_account_id, am.name AS advisory_name, at.name AS advisory_type,
576-
count(sp.inventory_id) as applicable_systems
577-
FROM system_advisories sa
578-
JOIN system_platform sp ON sa.rh_account_id = sp.rh_account_id AND sa.system_id = sp.id
579-
JOIN inventory.hosts ih ON sp.inventory_id = ih.id
580-
JOIN advisory_metadata am ON sa.advisory_id = am.id
581-
JOIN rh_account ra ON ra.id = sa.rh_account_id
582-
JOIN advisory_type at ON am.advisory_type_id = at.id
583-
GROUP BY ra.name, am.name, at.name
584-
ORDER BY ra.name ASC, applicable_systems DESC;
576+
adv.applicable_systems AS applicable_systems
577+
FROM (SELECT sp.rh_account_id, sa.advisory_id, COUNT(sa.*) as applicable_systems
578+
FROM system_advisories sa
579+
JOIN system_platform sp ON sa.rh_account_id = sp.rh_account_id AND sa.system_id = sp.id
580+
JOIN inventory.hosts ih ON sp.inventory_id = ih.id
581+
GROUP BY sp.rh_account_id, sa.advisory_id
582+
) as adv
583+
JOIN rh_account ra ON ra.id = adv.rh_account_id
584+
JOIN advisory_metadata am ON adv.advisory_id = am.id
585+
JOIN advisory_type at ON am.advisory_type_id = at.id
586+
ORDER BY ra.name ASC, adv.applicable_systems DESC;
585587
586588
- apiVersion: metrics.console.redhat.com/v1alpha1
587589
kind: FloorPlan

0 commit comments

Comments
 (0)