title: SQL, MongoDB Architectural question, how to handle complicated page
body: <p>At the moment I have implemented the following relation schema in postgresql</p>
  <p><img src="https://i.stack.imgur.com/fSTVr.jpg" alt="1" /></p>
  <p>In the future, I am going to implement a sharding by <strong>job</strong> entity, so for each <strong>job</strong> I will have separate databases. That will significantly improve performance with big data.</p>
  <p><img src="https://i.stack.imgur.com/LXOZ9.jpg" alt="2" /></p>
  <p>But I have a problem with the page that displays a list related to the <strong>user</strong> <strong>actions</strong>.</p>
  <p><img src="https://i.stack.imgur.com/i4L6t.jpg" alt="3" /></p>
  <p>So the query should go through each database (separated for each job) to query all results, applying filters/searches/ordering/pagination required by the page, and also return the information of pretty much all entities present in the relation tree. This looks like an impossible task for now.</p>
  <p>At the moment, my idea is to use a non-relational database (MongoDB) for this page to replicate the data needed to be displayed, which will lead to an impressive amount of work for data synchronization and I'm not certain that mongo could handle such a task (I expect really frequent updates because it needs to store info of probably each table present in my relation tree). Perhaps it is worthwhile to somehow revise the data storage structure or there is another simpler better solution (without data copying). Will be glad to hear any suggestions.</p>
  <p><strong>UPD:</strong></p>
  <p>Stopped on the mongo solution for now</p>