The HierarchyID Datatype in SQL Server 2008

  • Comments posted to this topic are about the item The HierarchyID Datatype in SQL Server 2008

  • Good article. The concept will be more clear when I started to use SQL Server 2008. But kudos to the author.

  • Good article. The only question I have is on the performance testing. By making the heirarchyid column the primary key you gave that method a distinct advantage over the classic method because that is now the clustered key. How likely is it that your heirarchy is going to be the clustered key? I do not have SQL 08 so I cannot test against it, but by changing the clustered key to the manager id column you get a clustered index seek within the CTE. How would this performance compare to the heirarchyid method? Could someone who has SQL 08 check it?

  • This article was clear, concise, and well written, and it will be a big help when we do make the transition to SQL Server 2008.

    I am curious about the performance testing you listed though. Have you tried any time tests on similar datasets to get actual time results? Could your choice of indexes have had a major impact on it?

    ---
    Timothy A Wiseman
    SQL Blog: http://timothyawiseman.wordpress.com/

  • Sorry but I was lost after the first part of the article. I don't know if you are a non-english speaker but you speak in incomplete sentences and it makes your article hard to follow.

  • JPR thanks, articles like your's help us to better understand this new feature.

    We're curious about MS's approach to inserting a sibling between two others. It looks like after all the "slash delimited" path info (we understand its not really slashes but rather some binary scheme), an id is available that can be used to order "this" node in a consistent fashion relative to it's siblings.

    So pretending like periods are used, let's say we want to insert a sibling between siblings 1.2 and 1.3. We assume the new id would be 1.2.1. Can you tell us how many more bytes (or nibbles or bits) it took to represent 1.2.1 than either 1.2 or 1.3?

    Also, if we keep inserting after the last id, between 1.2.1 and 1.3, 1.2.2 and 1.3, 1.2.3 and 1.3 etc, will we go up to 1.2.256 before rolling over to 1.2.256.1?

  • Nice article.

    Does anyone know if AS in SS08 supports the HierarchyID type for parent-child hierarchies? There's a lot of very specific logic in AS for the current linkage (ID and parentID columns) approach.

    Also, it seems to me that the performance aspects would need to be considered carefully on an application basis: if re-parenting a sub-tree is a frequent application function, I would think the current linkage approach would dramatically outperform the new HierarchyID type approach. Similarly, if an application executes more queries that are only interested in a single level (not a full sub-tree), performance with the existing approach would be generally better.

    -frank


    The End.

  • Thanks for the article! Hierarchy functionality is always tricky, and this just might simplify it. I'll need to play around with it.

    I'm wondering if this solves the complexities inherent in the adjacency model we all know and love so well /sarcasm.

    Is there talk about this being a new ansi standard, or it is destined to be a vendor specific implementation? I'll use it either way, but more convenient if cross platform compatibility is at least an option.

    I also like Change Data Capture for ETL, it's very convenient and powerful. And the new Merge syntax is sweet, and does away with multiple source updates to the same destination.

    It seemed like English was your second language, which is awesome, good job. However, you might want to get a native speaking English person to act only as editor; your articles will be stronger for it.

    Signature is NULL

  • Wow, I barely understood a word of this article! Hopefully the SS documentation will do a better job of explaining this data type, because now I'm not sure what it does!

    I realise that English is not everyone's first language, but then again not everyone is attempting to write articles in a language they have barely grasped.

  • There are constructive ways to say things and non-constructive ways to say things. Didn't your momma teach you the difference between these?

    Signature is NULL

  • Good article. I just switched to SQL server 2008 and I played a little with all those hierarchy functions.

    There is a typo though. The function is not IsDescendant but IsDescendantOf.

    Other than that. Great Article.

    Clement

  • Your example shows

    SELECT *

    From dbo.Organization

    WHERE @BossNode.IsDescendant(EmployeeID)

    How is this rewriten using IsDescendantOf?

    Thanks for the article, very interesting!

    Jake

    Found the answer in case any other newbs stumble across this:

    DECLARE @C AS HierarchyID

    SELECT *

    From dbo.Organization

    WHERE @C.IsDescendantOf(Organization.EmployeeID)

  • And Reparent is now GetReparentedValue...

    Good article, I am wandering myself about using this rather than the old child / parent id of past. One of the issues where I work, is getting everyone on the same page.

    P.S I know this was written a year ago.... how things change! 😛

  • Great article. I apologize for my rude English-speaking compatriots. You seem to speak French natively, and I very much appreciate your writing the article in English, because I sure don't speak French. Incidentally, I had little trouble understanding your article, but it would be a good idea to get an English editor in the future. You could even contact me!

  • [font="Tahoma"][/font]

    Extremely well-written article with lots of valuable input but as some of the readers have observed (rather correctly), it would have been greatly helpful if the French was somehow substituted with English (the World's accepted dictum) that would make the author's sincere efforts fully appreciated and assimilated as should be...

    I wish I knew French and that would have certainly made it easier to think like the author....If wishes were horses...:)

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic. Login to reply