diff --git a/.server-changes/narrow-metric-environment-lookup.md b/.server-changes/narrow-metric-environment-lookup.md new file mode 100644 index 00000000000..1d6326e72c8 --- /dev/null +++ b/.server-changes/narrow-metric-environment-lookup.md @@ -0,0 +1,6 @@ +--- +area: webapp +type: improvement +--- + +Dashboard charts load with less database work behind the scenes diff --git a/apps/webapp/app/services/queryService.server.ts b/apps/webapp/app/services/queryService.server.ts index bcceca25bbb..a14a2415509 100644 --- a/apps/webapp/app/services/queryService.server.ts +++ b/apps/webapp/app/services/queryService.server.ts @@ -359,7 +359,8 @@ export async function executeQuery( }); const environments = await prisma.runtimeEnvironment.findMany({ - where: { project: { organizationId } }, + // Same set as filtering through `project`, but hits the indexed column without the join. + where: { organizationId }, select: { id: true, slug: true }, });