How to design microservice database one to many?
There are various ways of best database practices when dealing in micro services , it may differ with respect to domain of the entities which are being used , and also the scope of your application use.
There are few best practices for database design in micor services , to start with listing few of them
1 - Private-tables-per-service – each service owns a set of tables that must only be accessed by that service2 - Schema-per-service – each service has a database schema that’s private to that service3 - Database-server-per-service – each service has it’s own database server.
You can mix and match these are per your data size and data count.
I would like you to refer and go through this page for a perfect example.
Microservices Database Best practices
Identify the load on each service that you will have. Load can be counted in 2 ways.
- Data load (how much data will be retrived)
- Service hit count (how many times service will be called)
Then you can decide the appraoch.