SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


HierarchyID performance problems... Really???


HierarchyID performance problems... Really???

Author
Message
CGSJohnson
CGSJohnson
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2096 Visits: 1686
We are now just evaluating its use in our shop. We would not have big data to work with though.

Thanks...Chris
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87728 Visits: 41121
Sean Lange (10/4/2011)
I think that may be further proof that few people has utilized this...nobody want to speak on a topic that they don't know about. I am hoping I can find some time soon to look through the test you have so far. I know I am going to have a project in the next few months where this could be really useful. In my case I would need more of a forest (multiple roots) but I may be able to use the hierarchyID as part of the solution.


That's exactly what I'm thinking, Sean.

Shifting gears, I've done some rather extensive work with "forests of trees" using Nested Sets. I can't say what we're using it for because it's a proprietary process that might be patentable. If you can say, what would you be using it for? I'm asking because I might be able to help with some of the information I've developed for the article I'm slowly putting together on the subject of Hierarchical queries.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87728 Visits: 41121
CGSJohnson (10/4/2011)
We are now just evaluating its use in our shop. We would not have big data to work with though.

Thanks...Chris


Thanks for the feedback, Chris. I realize it's a bit off subject for this thread but what would you end up using hierarchical structures for?

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
CGSJohnson
CGSJohnson
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2096 Visits: 1686
Hi, Jeff. Sorry, but I cannot talk about it all. However, one use would be for the common goal of organizational structure.

Thanks...Chris
Sean Lange
Sean Lange
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26386 Visits: 17557
Jeff Moden (10/4/2011)
Sean Lange (10/4/2011)
I think that may be further proof that few people has utilized this...nobody want to speak on a topic that they don't know about. I am hoping I can find some time soon to look through the test you have so far. I know I am going to have a project in the next few months where this could be really useful. In my case I would need more of a forest (multiple roots) but I may be able to use the hierarchyID as part of the solution.


That's exactly what I'm thinking, Sean.

Shifting gears, I've done some rather extensive work with "forests of trees" using Nested Sets. I can't say what we're using it for because it's a proprietary process that might be patentable. If you can say, what would you be using it for? I'm asking because I might be able to help with some of the information I've developed for the article I'm slowly putting together on the subject of Hierarchical queries.


I have kind of wondered if the nested set would be easier/better for my situation. I am not doing it for anything proprietary by any stretch of the imagination. I am going to be completely rebuilding our menu system for one of our websites. The original knuckleheads that "designed" should be shot. I am thinking that the forest of trees would be perfect for this. It will not likely get very "deep" but the second and third levels can get fairly large as this is a ecomm site for about a half million skus. I can imagine how cool it would be if I could move whole "branches" from one tree to another, or at least copy them from one to the other.

I could of course do this pretty simple with an adjaceny list but what fun is recreating a technique that is already way out of date when there are better ways of accomplishing this?

I would be thrilled to help in anyway that I can.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87728 Visits: 41121
Sean Lange (10/4/2011)
I could of course do this pretty simple with an adjaceny list but...


Oddly enough, I've found "hybrid" tables that contain an Adjacency List, Hierarchical Path (without the HierarchyID, so far), and Nested Sets to have advantages that no one particular method has. For example and as you've said, it's very easy to move, add, and delete nodes and whole sub-trees in the Adjacency List (a human can easily eye-ball the correct changes, if necessary) but there's some blinding speed and query flexibility to be had with Nested Sets.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87728 Visits: 41121
CGSJohnson (10/4/2011)
Hi, Jeff. Sorry, but I cannot talk about it all. However, one use would be for the common goal of organizational structure.

Thanks...Chris


Understood. Thanks for the thought, anyway.

Yep... I agree... organizational structures are a primary use of hierarchies.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87728 Visits: 41121
I guess I can wrap this thread up by saying I've done a deeper dive on some of the internet posts that claim performance problems with the HierarchyID datatype and its related methods. So far, all of them have turned out to be "false alarms" where certain (bad) programming practices, such as the use of non-SARGable search predicates, were used that would slow down any query and not just those related to the HierarchyID.

I haven't given up the search for actual performance problems caused by the use of the HierarchyID datatype or related methods, but I'm going to turn my efforts more to comparing performance between the HierarchyID methods and Nested Set methods.

Thanks to the good folks who posted on this thread and, believe it or not, thanks to the folks that didn't... it kind of shows that not a whole lot of people have to work with Hierarchies and the ones that are, simply aren't having performance problems with their hierarchies, are not working with large hierarchies, or are simply not aware that they may have a performance problem.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
ALZDBA
ALZDBA
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12378 Visits: 8930
CGSJohnson (10/4/2011)
Hi, Jeff. Sorry, but I cannot talk about it all. However, one use would be for the common goal of organizational structure.

Thanks...Chris


Don't talk to Jeff about it, if you'd have to kill him afterward ! I need him next Tuesday evening Hehe

Back to the topic though, I haven't seen HierarchyID being used.
I only played a bit with it to just get a little grip on it.

BTW you don't need million row objects to get into performance problems, so strive for most optimal setup as much as you can !

Johan


Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere w00t

- How to post Performance Problems
- How to post data/code to get the best help


- How to prevent a sore throat after hours of presenting ppt ?


press F1 for solution, press shift+F1 for urgent solution :-D


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me Alien but most of the time this is me Hehe
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87728 Visits: 41121
ALZDBA (10/5/2011)
BTW you don't need million row objects to get into performance problems, so strive for most optimal setup as much as you can !


Heh... true enough. Some of the posts with "performance problems" talked about hierarchy tables with only a thousand or so rows. That's why I test with a million... it makes the "thousands" easy. :-D

Thanks for the feedback, Johan. I know a lot of folks that say they're going to impliment it "soon" for one reason or another, but I don't know of anyone who actually has. I know a couple of folks that have implimented hierarchies in their work... they just haven't done it using the HierarchyID datatype.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search