|
Posted by Stefan Rybacki on 10/19/05 23:32
NC wrote:
> Naich wrote:
>
>>I'm going to be putting a comments section on my site, similar to
>>something like Slashdot, i.e. nested comments in a tree structure.
>>My question is - is it better to get the entire set of comments
>>in one MySQL call and then use PHP to sort out the tree or would
>>it be more efficient to go up the branches with multiple MySQL calls?
>
>
> The first approach may result in high memory requirements, the second
> will be much slower.
>
> The best approach woould be to figure out a database structure that
> would allow you to retrieve all comments in one query in the correct
> order, so no PHP sorting is required.
The problem if such a structure is the overhead on inserting new data. And since he has a
comment system, insertion could be very often. Don't get me wrong I would prefer such a
structure but I'm not sure whether the OP get it to work or whether the insertion takes to
long.
Regards
Stefan
>
> Cheers,
> NC
>
Navigation:
[Reply to this message]
|