Skip to content

How to projection to different database? #2457

Answered by gfoidl
legendxian asked this question in General
Discussion options

You must be logged in to vote

But, CQRS said:
one Db to write.
Another Db to read.

No, CQRS didn't say this. It's solely about separation of write (commands) and reads (queries). No word about the actual stores -- which BTW can be whatever fits best. Google / Bing for "cqrs myths" and you can read more about this.

If you want to the CQRS-flavor with different write and read dbs, then you could use the outbox-pattern to update the read-db, which contains materialized views / projections for faster querying.

it's High-efficiency

Maybe, it depends. But for sure it's way more work to develop, maintain, monitor, etc.
So go this route only if needed. To start I'd go with the same db for write and read side, so it's easy…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by legendxian
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #2451 on January 11, 2023 15:14.