Nested SQL Server vs Hierarchyid installations

I have hierarchical data. The most common queries will be “get the parent branch for node” and “get the subtree node”. Updates and inserts are unlikely to occur frequently. I choose between nested sets and hierarchy. As far as I know, searching in a nested set should be pretty fast for indexed columns, however, I have no idea about the internal implementation of the hierarchy. What should be used for maximum performance?

+7
source share
1 answer

Using HierarchyID and self-regulation tables in different projects, I would say that HierarchyId wins hands in terms of query convenience.
See Querying a hierarchical table using hierarchy methods to see how easy it can be with the built-in query methods for the HierarchyID.

+3
source

All Articles