Member-only story

Speed up your database using query-level cache policies with Prisma Accelerate

Emad Dehnavi
2 min readAug 16, 2024

One of the biggest problems we face when our product get a hit and our terrific increases is the high database query time and latency. You might think about vertical or horizontal scaling, which is an option but not necessary the most effective one.

Speed up your database using query-level cache policies with Prisma Accelerate

Then you might think about caching, which is another option, caching is great when you need to reduce database or application load, so requests can use the cached data to avoid spending app or database time computing the result. This will aslo help with your database costs, as most cloud providers charge you based on the DB reads/write.

So caching is a good option here, however you must be careful about when and how you cache your data, for example, if your app uses some data that must be exactly up-to-date to function, your probably don’t want to cache those.

Here is where Prisma Accelerate can fit best, becaouse not only adding caching with Prisma Accelerate is as easy as adding a cacheStrategy option to a query, but you can also find the right query to cache, plus caching queries with Prisma Accelerate is on a per-query basis, you are only charged for the queries you do cache.

Run a speed test

--

--

Emad Dehnavi
Emad Dehnavi

Written by Emad Dehnavi

With 8 years as a software engineer, I write about AI and technology in a simple way. My goal is to make these topics easy and interesting for everyone.

No responses yet