0

We have 1 table which has parent_id and child_id in the same table and parent-child hierarchy is being maintained in this single table. As the data is huge, its taking a long time to get any sorts of information from this table, which needs to refer to this hierarchy. I am new to MySQL. Can anyone please point me in the direction of normalizing this table into multiple tables to maintain this hierarchy in proper structure? This will help in reducing the query time and happy customers. I am using MySQL 5.7.18 and recursive CTE is not an option. I am going through the different solutions, but most of them are using self joins. Is there any way we can avoid self joins? Thanks in advance.

user1552698
  • 577
  • 3
  • 9
  • 24
  • Possible duplicate of [What are the options for storing hierarchical data in a relational database?](https://stackoverflow.com/questions/4048151/what-are-the-options-for-storing-hierarchical-data-in-a-relational-database) – Paul Spiegel Feb 07 '18 at 00:21
  • Also possible duplicate of [What is the most efficient/elegant way to parse a flat table into a tree?](https://stackoverflow.com/questions/192220/what-is-the-most-efficient-elegant-way-to-parse-a-flat-table-into-a-tree) – Bill Karwin Feb 07 '18 at 00:44

0 Answers0