Hi @Yohan
Despite the many ways you have come up with, there is still too little information for us.
I can only make some general suggestions.
Do you try using an index on the columns that are involved in the recursion?
Or use a query hint such as OPTION (MAXRECURSION n) to specify the maximum number of recursions.
If you want to delve further into how to optimize recursive queries, you can check out this paper.
https://www2.cs.uh.edu/~ordonez/pdfwww/w-2010-TKDE-lrq.pdf
Best regards,
Percy Tang