You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add separate databases for reading and writing.
In the template, both databases can use PostgreSQL (it can be changed in a particular microservice, depending on specific needs).
To do:
Add a new Postgres instance to docker-compose
Create two separate repositories and entities (one for reading and one for writing)
Differ data in these databases (just to show the example)
Database for commands should as it is now. The new database for queries should be used for all "GET" operations. In addition, it is important to keep this DB synchronized with the commands database. For this purpose, we need to handle proper events and update this database asynchronously, in the background.
What is the motivation / use case for changing the behavior?
In many cases, we will need to get complicated data from many microservices in a single query. To avoid making "in memory joins" in the API gateway that are inefficient we decided to use CQRS pattern. Separate databases are one of the main points of this pattern. Thanks to that we will store data similar as much as possible to these ones fetched by clients.
The text was updated successfully, but these errors were encountered:
Feature Request
Describe the solution you'd like
Add separate databases for reading and writing.
In the template, both databases can use PostgreSQL (it can be changed in a particular microservice, depending on specific needs).
To do:
Teachability, Documentation, Adoption, Migration Strategy
Database for commands should as it is now. The new database for queries should be used for all "GET" operations. In addition, it is important to keep this DB synchronized with the commands database. For this purpose, we need to handle proper events and update this database asynchronously, in the background.
What is the motivation / use case for changing the behavior?
In many cases, we will need to get complicated data from many microservices in a single query. To avoid making "in memory joins" in the API gateway that are inefficient we decided to use CQRS pattern. Separate databases are one of the main points of this pattern. Thanks to that we will store data similar as much as possible to these ones fetched by clients.
The text was updated successfully, but these errors were encountered: