I have no idea what you want to do, so I suggest you give an output example.
In addition, the performance of code that handles infinite categories is generally very poor. You can try to create four layers in the database with more than four elements in each layer, and how much time it takes to read from the top layer at a time.
If the performance is really poor, you must use SQL processing. The design of the two data tables corresponds to two methods
I have no idea what you want to do, so I suggest you give an output example.
In addition, the performance of code that handles infinite categories is generally very poor. You can try to create four layers in the database with more than four elements in each layer, and how much time it takes to read from the top layer at a time.
If the performance is really poor, you must use SQL processing. The design of the two data tables corresponds to two methods