perf: select only needed columns from GisUat, skip geometry (~100MB)

This commit is contained in:
AI Assistant
2026-03-23 13:23:23 +02:00
parent ad4c72f527
commit d0c1b5d48e
+5 -1
View File
@@ -124,7 +124,11 @@ export async function GET(req: Request) {
const url = new URL(req.url);
const withFeatures = url.searchParams.get("features") === "true";
const rows = await prisma.gisUat.findMany({ orderBy: { name: "asc" } });
// CRITICAL: select only needed fields — geometry column has huge polygon data
const rows = await prisma.gisUat.findMany({
orderBy: { name: "asc" },
select: { siruta: true, name: true, county: true, workspacePk: true },
});
// Feature counts are expensive (scans entire GisFeature table)
// Only include when explicitly requested