Prisma Accelerate provides managed connection pooling and a global edge query cache for Prisma ORM. It is essential for serverless deployments where ephemeral function instances would otherwise exhaust database connection limits.
0 / 5 completed
1 / 5
What two core features does Prisma Accelerate provide?
Prisma Accelerate is a managed infrastructure layer with two pillars: a connection pooler that multiplexes serverless/edge function connections to your database, and a global edge cache that caches query results at edge nodes close to users, reducing latency and database load.
2 / 5
What does the cacheStrategy option in a Prisma Accelerate query control?
cacheStrategy is passed to individual Prisma queries to control Accelerate's edge cache behaviour. ttl sets how long a cached result is considered fresh, and swr defines a window after TTL expiry during which stale data is served while a background refresh runs, similar to HTTP stale-while-revalidate.
3 / 5
What is the swr (stale-while-revalidate) value in Prisma Accelerate's cache strategy?
swr in Prisma Accelerate mirrors the HTTP stale-while-revalidate pattern. After the ttl expires, the cache returns the stale result immediately (avoiding latency) and triggers a background database fetch. The swr value sets the additional window (in seconds) during which this stale serving is allowed before the cache entry is fully invalidated.
4 / 5
How does Prisma Accelerate's connection pooling help serverless deployments?
Connection pooling in Prisma Accelerate is critical for serverless because each function invocation would otherwise open and close a database connection, quickly exhausting Postgres's connection limit. Accelerate acts as a persistent proxy that reuses a smaller pool of real connections, translating many ephemeral function connections into a manageable number of database connections.
5 / 5
How do you enable Prisma Accelerate in a project?
To use Prisma Accelerate you replace your database URL with the Accelerate proxy URL (starting with prisma://) and extend the client: const prisma = new PrismaClient().$extends(withAccelerate()). The withAccelerate() extension (from @prisma/extension-accelerate) unlocks the cacheStrategy option on queries.