Reputation: 1
My goal is to create a social media and I'm planning to use microservice architecture. I want to create user-service and post-service. Post service will get a user id and return their posts.
In the database side, I was thinking about using a relational database, having a "post" table with user_id as a foreign key in it. However I heard that microservices should have different databases. So "user" and "post" tables should be in seperate databases.
In that case why would I choose a relational database instead of a non-relational database? Referring to a primary key in a different database with a foreign key in the current database makes no sense for me.
Upvotes: -1
Views: 357
Reputation: 63
In most cases multiple tables might be required for each service (e.g. your user-service would have many other tables related to users and not just one table) and having relational database helps maintaining relations amongst those table of single service.
Upvotes: 1