I have a table with a representation of a linked list
id | parent
1 | 1
2 | 1
3 | 2
4 | 3
...
I know for a fact that mysql does not have the tree building capabilities built in for queries but I was wondering if anyone had used stored procedures to perform this sorting. Currently I am performing the sorting in my domain code but the table as to be read by an external system and performance is paramount on the external system so I would like to provide it with an already sorted list to not use its the precious CPU cycles.
Other advices are welcomed as this is still in the design phase.
MySQL doesn’t have the handy
START WITH / CONNECT BYsyntax that Oracle does, however, you might want to check out this link from someone who tried to mimic this same functionality in MySQL.