Merge pull request #8864 from RoadieHQ/query-perf-tweaks-for-tech-insights

[TechInsights] Modify queries to perform better by filtering on subqueries as well
This commit is contained in:
Ben Lambert
2022-01-11 16:44:44 +01:00
committed by GitHub
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-tech-insights-backend': patch
---
Modify queries to perform better by filtering on sub-queries as well
@@ -112,6 +112,8 @@ export class TechInsightsDatabase implements TechInsightsStore {
this.db('facts')
.max('timestamp')
.column('id as subId')
.where({ entity: entityTriplet })
.and.whereIn('id', ids)
.groupBy('id')
.as('subQ'),
'facts.id',