our main DB structure looks like this:
1. Users.
2. Companies.
3. Companies Posts.
4. User_Companies
5. User_Likes
The issue is that we cannot do JOINs, even if we denormalize the data, things get complicated, since we need to join it with the current user's companies list, take the data paginated and order it by date.
We already thought of building a background script which denormalize the data for each user and builds him a user_feed on each change (like/unlike/new post published/post removed/etc.) but it was very very heavy CPU/RAM process which caused a lot of issues and finally didn't work in a large scale of users and companies.
Moreover, we noticed that we able to filter our data only by one field (no multi WHERE CLAUSES), now for example we'd like to filter out posts that were already like/unliked by the user, paginated it, order by date and JOIN with user's companies.
We already started thinking of moving our application to a new hosted server on cloud and build our own infrastructure :( with SQL DB so we can make some relational queries, but before that we need someone to guide us maybe there are other options, to still stay with a firebase solution.
Thanks,
Nitzan.