Rich schema vs query performance
The Problem
Cars link to brands, models, categories, features, and rentals—naive joins caused slow browse queries.
How I Solved It
Used Drizzle relational queries with selective columns and indexed foreign keys.
const cars = await db.query.cars.findMany({
where: and(eq(cars.available, true)),
with: { model: { with: { brand: true } } },
limit: 20,
});

