Modify queries to perform better by filtering on subqueries as well

Signed-off-by: Jussi Hallila <jussi@hallila.com>
This commit is contained in:
Jussi Hallila
2022-01-11 12:09:17 +01:00
parent 4c9c45f351
commit 10f26e8883
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 subqueries 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',