Postgres read slaves?
Is there a way to connect the orm to use a read slave for selects and master for writes?
11 Replies
There is no config option or something like that
But you could have 2 different instances of Drizzle, each one fed with the same schema, but a different connection string
I don't see any issues with running that set up
You would use one instance or the other depending on what you're doing
It would be good to see Drizzle support this more natively like many other ORMs do.
As an ORM it is well positioned to know read vs write queries and automatically route queries to the correct connection/pool
Would you like to submit a feature request? You could also create a wrapper object that would handle it for you.
True, I might consider something like that as well. I do have some more advanced read replica query patterns where I would route based on async context / environment configuration where this might be useful
Are there ORMs that handle that for you?
Not that specifically, it would be quite a niche pattern so I wouldn’t expect any to support it either
give us a few days
You guys might want to vote on drizzle's twitter pole on this
repliwhat 😂
any updates?