Sample Header Ad - 728x90

Possible options for SQL and NoSQL combination for social media data

0 votes
1 answer
52 views
I have searched this forum for an answer but could not find anything relevant. We are designing database schemas for a social media app with posts, groups, users and chats etc and it looks like we have a mix of structured and unstructured data so initially decided to go with PostgreSQL and Mongo. We also have to restrict some data to some regions because of compliance and regulations but allow the rest of the data globally because of users moving around globally. Since we don't have anything critical like a bank, we are wondering if we just have to go with Mongo all the way as it makes our business logic, deployment and maintenance simple and fast. One issue is the many-many relations like user belongs to many groups and a group has many users. In relational, I could have a table with rows (group_id and user_id) and I can easily get all users in a group or all groups a user is in. In unstructured, I can store groups list in user's document and users list in group's document but now if a user joins a group, it becomes two updates (user's document and group's document). Same logic for user liking a post. Here we want all users who liked a post and all posts that the user liked. Even if one does not need one piece of information in real-time such as the app never shows the groups a user is in to the user, we might need it for data analysis which means we have to extract this from reading all groups' documents. We also feel PostgreSQL is cheaper when looking at AWS RDS vs MongoDB Atlas, so tempted to at least use it partially. Could anyone please let us know if there is an elegant solution for this or any blogs, posts that gives a solution? Regards, KSRD
Asked by dksr (101 rep)
Nov 30, 2023, 11:03 AM
Last activity: Nov 30, 2023, 01:44 PM