David
David17mo ago

How would batching result in a single database query?

On the httpBatchStreamLink docs it says that multiple query calls could result in a single database query. How would that work? Should you expect the passed input to possibly be an array to allow for this?
After that, you can make use of batching by setting all your procedures in a Promise.all. The code below will produce exactly one HTTP request and on the server exactly one database query:
After that, you can make use of batching by setting all your procedures in a Promise.all. The code below will produce exactly one HTTP request and on the server exactly one database query:
4 Replies
Alex / KATT 🐱
Alex / KATT 🐱17mo ago
if you use a dataloader for fetching stuff
Alex / KATT 🐱
Alex / KATT 🐱17mo ago
GitHub
GitHub - graphql/dataloader: DataLoader is a generic utility to be ...
DataLoader is a generic utility to be used as part of your application's data fetching layer to provide a consistent API over various backends and reduce requests to those backends via batc...
Alex / KATT 🐱
Alex / KATT 🐱17mo ago
Prisma
Query optimization
How Prisma optimizes queries under the hood
David
DavidOP17mo ago
Thank you! Is there some example code for this using trpc?