A practical approach to query paths, caching, async work, and production safety.
Performance starts with understanding the request path, data shape, and user-facing constraints. I prefer bounded reads, narrow selects, explicit indexes, cache discipline, queue-backed async work, and measurable verification before claiming improvement.
Bounded Prisma reads with explicit fields keep API payloads predictable.
const orders = await prisma.order.findMany({
where: { customerId, status: { in: ["open", "paid"] } },
select: {
id: true,
status: true,
total: true,
createdAt: true,
},
orderBy: { createdAt: "desc" },
take: 50,
});backendperformancepostgresqlredis