4 ms·
just for your sanity in a relational database alway put a root id for hierarchies. Also, you might want to skip the null and use a self reference depending on
by protomyth 7y ago
just for your sanity in a relational database alway put a root id for hierarchies. Also, you might want to skip the null and use a self reference depending on how you need to build the hierarchy. Root only matters if you have multiple hierarchies in a table.
- tracker1 7y ago+1 for root-id, this is a huge failing in a lot of threaded discussion table designs.
- protomyth 7y agoYeah, it really helps if you have to do some processing in the stored procedures and it helps with the query speed if properly indexed. I have seen folks put a level number in the table also, but that really depends on what the hierarchy represents.