Merge pull request #34190 from backstage/freben/facets-count-optimization

fix(catalog-backend): simplify facets COUNT(DISTINCT) to COUNT(*)
This commit is contained in:
Fredrik Adelöw
2026-05-12 15:32:08 +02:00
committed by GitHub
3 changed files with 28 additions and 22 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Simplified the entity facets aggregation from `COUNT(DISTINCT entity_id)` to `COUNT(*)`. The unique constraint on `(entity_id, key, value)` guarantees each entity appears at most once per search row group, making the `DISTINCT` unnecessary. This allows the database to use a simpler aggregation plan.