0

"All modern chatting interfaces, without exception, implement a hierarchical and a not-chronological schema for chat"

I was searching for SO answers and came across this:

https://dba.stackexchange.com/questions/192172/how-to-create-a-flexible-table-schema-for-storing-messages-from-different-chats

What are the benefits of using a hierarchy schema over a chronological schema?

  • I can only imagine that Evan is referring to "threaded comments" when he makes that assertion. If your messages have a "reply to" field, your schema is already hierarchical, since you can reply to a message that has replied to someone else. – Robert Harvey Dec 3 '19 at 15:59
1

First of all, is there any evidence, other than this SO answer, that confirm that modern chat application are using such a hierarchical scheme ?

Hierarchical scheme corresponds to a table that references itself, creating a one-to-many parent child relation between rows:

  • it is useful if you want a hierarchy of messages, where for any posting you need to be able to quickly find all the related dependents.
  • if it has to replace the chronology, it would require a strong ordering in which every chat contribution is posted to exactly one previous contribution. Such a model creates a concurrency bottleneck if your chat is a very flat group chat instead of a structured post reply
  • is more complex to manage on the application side
  • it is not mutually exclusive with the chronology: a timestamp column could enable to sort answers to the same initial message without creating a bottleneck.

It’s difficult to say if it’s the best approach. Deeply nested messages are very useful in some cases (e.g. Q&A forums), but are difficult to browse through. A flat structure can make things much simpler if the users do not need the extra hierarchical complexity (e.g. friend group on instant messaging).

If the depth is 1 (your title) I would really think twice, to check if both levels are exactly the same, or if the two levels do not consist of different informations (e.g. group name, participants, admins, tagging on one side and flat list of contributions on the other side).

0

If you want your messages in chronological order, you need to store them using a chronological schema. If you want your messages in hierarchical order, you need to store them using a hierarchical schema.

There is no situation in which you would choose between them, so it doesn't make sense to ask about the benefits of one over the other.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.