Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(reader): add support for read replica #137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

johannsonic
Copy link

@johannsonic johannsonic commented Aug 30, 2024

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

@tylerjbainbridge
Copy link

Would love to see this landed :)

@eoin-obrien
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants