Cache vs memory perf in convex function scope
Contrived scenario:
- A query needs to return a list of hundreds of restaurants from the restaurants table
- Each restaurant can be in one of 10 total regions from the regions table
Option A:
- Run an indexed query that gets all of the regions up front
- Synchronously map over the list of restaurants and add the region data to each
Option B:
- Asynchronously map over the list of restaurants and run
ctx.db.get() for each region id, resulting in many duplicate calls to the same queryOne would assume that option A will be more performant. But if caching is deduped and truly in-memory, it probably won't be meaningfully different. Is one approach better? Does it become worthwhile at scale?
