MySQL – Implement the hierarchical data structure in the database

I know there are two methods: adjacency list and nested tree. It is said that due to a large number of queries, the adjacency list will be slow to traverse. But I don’t know any actual numbers in this regard The website I’m making will have 200 pages. Does it take more than 0.3 seconds to traverse to generate (for example) a sitemap?

Use the LAMP stack to run on MySQL (innoDB).

If possible, I would prefer to implement adjacency because the design is simpler.

Thank you.

In addition to the two options you mentioned, there are more options. There are:

> adjacency list (almost everyone uses “parent_id”)
>nested set
>path enumeration
>close list (also called adjacency Relationship)

Look at my answer to “What is the most efficient/elegant way to parse a flat table into a tree?”

Or a few books:

< p>> Joe Celko’s “Trees and Hierarchies in SQL for Smarties”.
> Vadim Tropashko’s “SQL Design Patterns”.

I know there are two ways : Adjacency list and nested tree. It is said that due to a large number of queries, the adjacency list will be very slow to use in traversal. But I don’t know any actual numbers in this regard. The website I’m making will have 200 pages. Traverse generates (for example) sites Does the map take more than 0.3 seconds?

Use the LAMP stack to run on MySQL (innoDB).

If possible, I would prefer to implement adjacency because the design is simpler.

Thank you.

In addition to the two options you mentioned, there are more options. There are:

>Adjacency list (“parent_id” used by almost everyone)
>Nested set
>Path enumeration
>Close table (also known as adjacency relationship)

See what I am right The answer to “What is the most efficient/elegant way to parse a flat table into a tree?”

Or a few books:

> Joe Celko’s “Trees and Hierarchies in SQL for Smarties”.
> “SQL Design Patterns” by Vadim Tropashko.

Leave a Comment

Your email address will not be published.