I am reading the SQL server 2008 bible and it says the materi开发者_StackOverflow中文版alized path pattern is significantly faster then the hierarchyid. Is this really true? How can I make the hierarchyid have equal or better performance.
The chapter explains three methods for designing and querying hierarchies: Adjacency Pairs, Materialized Path, and HierarchyID. These are three solutions to the same problem so yes, it makes perfect sense to compare these three methods. The truth is that Materialized path is the fastest but Adjacency Pairs can solve more types of hierarchy problems. HierarchyID is clumsy, difficult to query, and, if you follow MSFT’s recommendation, it only stores the relative position, not the key, so it’s less robust.
Do you mean materialized path vs. nested sets or ? A materialized path pattern can employ a hiearchyid datatype. It doesn't make sense to compare the speed of a pattern vs a datatype.
精彩评论