S
S
Sergey2015-04-09 17:00:32
PHP
Sergey, 2015-04-09 17:00:32

How to store dialogs of unlimited nesting with hierarchy?

Good day.
The question arose about storing comments with the preservation of the hierarchy and unlimited nesting. There will be a lot of messages, so nested sets will most likely not work. I'm considering Adjacency List, but processing a lot of raw data in php will take a lot of time. There is an option to use Materialized Path - it looks like the best, but so far I have accumulated too little information on it, especially on how to sort it for delivery to the frontend.
I ask for wise advice, new words for googling, or even better - links for reading. Thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
FanatPHP, 2015-04-09
@Pjeroo

what difference does it make how many posts there will be if each particular comment thread does not exceed a few hundred?
But MP is really the most convenient option. According to the MP field and sort - it was invented for this.

X
xmoonlight, 2015-04-09
@xmoonlight

id, item, parent_id
To display the hierarchy - when querying from the database - recursion by a stored procedure.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question