jeudi 11 novembre 2021

Nested comment DB schema and DB choice?

Hi I need to design the nested comments architecture like comments on blog/jobs etc in linkedin.

Please below the high level sql schema for the same

enter image description here

Here is the high level algo

  1. Select all the top level comments with parent as
  2. Select second level comments whose parents were found in the step prior
  3. Select further level comments whose parents were found in the step prior

To get the details about likes/comments , will trigger another query to table comment_attributes ?

Does this design looks good in principle ?

Also I am planning to use the nosql db(MongoDB) here primarily because of sharding capabilities where I can partition it based on entity type like blogs/jobs etc and it can scale with more traffic, for that I am planning to use entity_type column in each table . Does it sound good ?

Aucun commentaire:

Enregistrer un commentaire