Skip to content

Commit 06aa8a8

Browse files
Use LEFT JOIN on allocator table in case of missing data
1 parent a7f5460 commit 06aa8a8

9 files changed

+18
-18
lines changed

prisma/sql/getStandardAllocatorBiggestClientDistribution.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ select "week" as "week",
1010
count(*)::int as "count",
1111
sum("totalDatacap")::bigint as "totalDatacap"
1212
from "allocators_with_ratio"
13-
join "allocator" on "allocators_with_ratio"."allocator" = "allocator"."id"
14-
where "allocator"."is_metaallocator" = false
13+
left join "allocator" on "allocators_with_ratio"."allocator" = "allocator"."id"
14+
where "allocator"."is_metaallocator" != true
1515
group by "valueFromExclusive", "valueToInclusive", "week"
1616
order by "week", "valueFromExclusive";

prisma/sql/getStandardAllocatorBiggestClientDistributionAcc.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ select "week" as "week",
1010
count(*)::int as "count",
1111
sum("totalDatacap")::bigint as "totalDatacap"
1212
from "allocators_with_ratio"
13-
join "allocator" on "allocators_with_ratio"."allocator" = "allocator"."id"
14-
where "allocator"."is_metaallocator" = false
13+
left join "allocator" on "allocators_with_ratio"."allocator" = "allocator"."id"
14+
where "allocator"."is_metaallocator" != true
1515
group by "valueFromExclusive", "valueToInclusive", "week"
1616
order by "week", "valueFromExclusive";

prisma/sql/getStandardAllocatorClientsWeekly.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ select "week" as "week",
44
count(*)::int as "count",
55
sum("total_sum_of_allocations")::bigint as "totalDatacap"
66
from "allocators_weekly"
7-
join "allocator" on "allocators_weekly"."allocator" = "allocator"."id"
8-
where "allocator"."is_metaallocator" = false
7+
left join "allocator" on "allocators_weekly"."allocator" = "allocator"."id"
8+
where "allocator"."is_metaallocator" != true
99
group by "valueFromExclusive", "valueToInclusive", "week"
1010
order by "week", "valueFromExclusive";

prisma/sql/getStandardAllocatorClientsWeeklyAcc.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ select "week" as "week",
44
count(*)::int as "count",
55
sum("total_sum_of_allocations")::bigint as "totalDatacap"
66
from "allocators_weekly_acc"
7-
join "allocator" on "allocators_weekly_acc"."allocator" = "allocator"."id"
8-
where "allocator"."is_metaallocator" = false
7+
left join "allocator" on "allocators_weekly_acc"."allocator" = "allocator"."id"
8+
where "allocator"."is_metaallocator" != true
99
group by "valueFromExclusive", "valueToInclusive", "week"
1010
order by "week", "valueFromExclusive";
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
select count(distinct "allocators_weekly_acc"."allocator")::int as "count"
22
from "allocators_weekly_acc"
3-
join "allocator" on "allocators_weekly_acc"."allocator" = "allocator"."id"
4-
where "allocator"."is_metaallocator" = false;
3+
left join "allocator" on "allocators_weekly_acc"."allocator" = "allocator"."id"
4+
where "allocator"."is_metaallocator" != true;

prisma/sql/getStandardAllocatorRetrievability.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ select "week" as "week",
66
count(*)::int as "count",
77
sum("total_sum_of_allocations")::bigint as "totalDatacap"
88
from "allocators_weekly"
9-
join "allocator" on "allocators_weekly"."allocator" = "allocator"."id"
10-
where "allocator"."is_metaallocator" = false
9+
left join "allocator" on "allocators_weekly"."allocator" = "allocator"."id"
10+
where "allocator"."is_metaallocator" != true
1111
group by "valueFromExclusive", "valueToInclusive", "week"
1212
order by "week", "valueFromExclusive";

prisma/sql/getStandardAllocatorRetrievabilityAcc.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ select "week" as "week",
66
count(*)::int as "count",
77
sum("total_sum_of_allocations")::bigint as "totalDatacap"
88
from "allocators_weekly_acc"
9-
join "allocator" on "allocators_weekly_acc"."allocator" = "allocator"."id"
10-
where "allocator"."is_metaallocator" = false
9+
left join "allocator" on "allocators_weekly_acc"."allocator" = "allocator"."id"
10+
where "allocator"."is_metaallocator" != true
1111
group by "valueFromExclusive", "valueToInclusive", "week"
1212
order by "week", "valueFromExclusive";
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
select avg("avg_weighted_retrievability_success_rate") as "average"
22
from "allocators_weekly"
3-
join "allocator" on "allocators_weekly"."allocator" = "allocator"."id"
4-
where "allocator"."is_metaallocator" = false
3+
left join "allocator" on "allocators_weekly"."allocator" = "allocator"."id"
4+
where "allocator"."is_metaallocator" != true
55
and "week" = $1;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
select avg("avg_weighted_retrievability_success_rate") as "average"
22
from "allocators_weekly_acc"
3-
join "allocator" on "allocators_weekly_acc"."allocator" = "allocator"."id"
4-
where "allocator"."is_metaallocator" = false
3+
left join "allocator" on "allocators_weekly_acc"."allocator" = "allocator"."id"
4+
where "allocator"."is_metaallocator" != true
55
and "week" = $1;

0 commit comments

Comments
 (0)