Open johannsonic opened 2 months ago
Would love to see this landed :)
Hi, and thanks for using prisma-extension-kysely
!
The extension should work with read replicas as-is, but the order the extensions are applied in (and the way the read replicas are created) can result in the primary Kysely instance being shared across the .$primary().$kysely
and .$replica().$kysely
.
I've added some documentation on it to the readme if you'd like to check it out and see if it works properly when run like that.
Hey!
We had a big problem in our production setup where all raw prisma-kysely queries hit our writer db, even for read-only operations. With this proposed solution, one can pass a configuration object to the extension and opt-in to use the replica instance for read queries.
I already used this implementation in our prod setup and our writer instance immediately cooled down :)
Johann