It is possible to DB available that may store tree structures (like for nested comments) without needing anti-designs or such.
I believe LDAP is a, but what are the others?
I have to have the ability to index childes too. I want so that it is simple to move a branch in one node to another node and become fast to see + format.
I've come across other similar questions. The issue with individuals (for me personally) they request what's the most effective method of doing it in db XXX, as i request which DB I ought to use.
Oracle supports hierarchical queries as they are with the
connect by facility. They will use this feature to aid their DB-planned LDAP implementation.
Relational databases will not be the greatest with this when the tree is extremely deep. I'd recommend a graph or object database.
"Storing comments"? Like individuals following blogs or articles? If that is the situation, I'd say that you could assume they will not be that deep. A ten level comment tree could be exceptional.
For the reason that situation, an easy relational parent/child relationship using foreign secrets could be sufficient:
CREATE TABLE IF NOT EXISTS article ( article_id integer not null auto_increment, comment_id integer, primary key(article_id), constraint fk_comment foreign key(comment_id) references article(article_id) on delete cascade on update cascade );
"Relational Databases", obviously, stress "tables" (2-D associations).
Among RDBMS suppliers, you will find a variety of options. For instance, DB2 has "hierarchical structures", and Oracle has "hierarchical queries":
More generally, the majority of the major RDBMS items (MS Sql Server, IBM DB2, Oracle) have become XML-aware. This gives a far more robust, portable method of adjusting structured data.
Obviously, among non-RDBMS suppliers, you will find much more options for coping with non-relational data (like trees). Correspondingly, there's less portability - securing yourself into one "non-SQL database" generally locks you out of trouble of easily moving the application to another database.
Main Point Here:
Should you can use XML having a relational database, that's most likely the best choice. Here are a few good links:
'Hope that can help!