Re:Fake Trees: Using Indents for Simpler UIs
by fs_tab on Saturday December 30, 2023 @12:08PM
(#38816756)
Yes, CTEs are fine. The author could have used one to generate a view containing formatted names instead of baking this information into the table.
Re:Fake Trees: Using Indents for Simpler UIs
by forgetfulness on Saturday December 30, 2023 @01:15PM
(#38817335)
I don't find CTEs particularly fun, copying and pasting the whole tower of CTEs into another SQL window to debug the one I'm interested in is decidedly not a form of entertainment I pursue.
Re:Fake Trees: Using Indents for Simpler UIs
by barrkel on Saturday December 30, 2023 @02:16PM
(#38818050)
You only need one recursive CTE typically and you can encode it into a view that you join against. It just sucks for performance when you have millions of nodes.
Re:Fake Trees: Using Indents for Simpler UIs
by barrkel on Saturday December 30, 2023 @02:13PM
(#38818027)
I found using recursive CTEs incredibly slow for assembling tree data from a normalized representation. It would make getting the results of a query at least d times slower for assembling the path of nodes d deep in the hierarchy. The upside was cheap tree edit operations but those were a lot less frequent than reads.
I promise you that CTEs, even recursive ones, are not scary and that once you get the hang of them are actually fun.