How to repair a corrupted MPTT tree (nested set) in the database using SQL?

前端 未结 4 600
我在风中等你
我在风中等你 2020-12-23 22:12

I have an MPTT tree of over 100,000 records stored in MySQL using lft, rght and parent_id columns. Now the left/right values became co

4条回答
  •  Happy的楠姐
    2020-12-23 22:58

    In all solutions provided, I was getting a problem where MySQL would prompt that it would be Running query for hours but nothing would happen.

    I then realized that if I set the lft and rght values to 1 and 2 in the first record of the tmp_tree table (the one with parent_id = 0), everything worked fine. Maybe the procedure needs updating to do this automatically.

提交回复
热议问题