When you ask for a new hierarchy between two other, the result is progressively longer, for example, There are only 2 / 5.6.1 and other 4 component paths between 2 / 5.6 and 2 / 5.7. The hierarchy data type is limited to 800 bytes, so you can not repeat it forever. Again, the integer types are also limited, but this is not a problem in practice. Should I defragment my table from time to time so that height is limitless?
It is considered a" best practice does not even grow " You then produce the sequential children, it is highly unlikely that you will ever have to worry about walking; You can literally have millions of children for every guardian. This example is how you can generate In this manner, you assured the rest that you will never have to worry about walking. Due to curiosity, I started a quick test to make sure how deep you can go, here is a test script: You can see this as a point-nest victim Is at 1426 level, so how many "between" nodes you can create for your worst is the worst condition limit, the worst case which means that every single entry has two deepest-nested Goes between the nodes. As I mentioned in the comments, killing this border is very difficult, but still it is not making a good idea of trying. The longer the longer the length of the actual byte, the more you use the "number", which decreases the performance. If hierarchy
"To add" new "to" "so that you do not use in-between states (like / 2/5/6 /
). If your hierarchyid
is a cluster primary key that is bad for performance, this will cause a similar division of page pathway to a uniqueidentifier
. hierarchy
values:
set transaction isolation level serializable start transaction update hierarchy set @LastChild = LastChild = HId.GetDescendant (LastChild, zero) where hidden = = ParentID embedded hierarchy (HID, ...) values (@LastChild, ..) COMMIT
announcement @parent hierarchyid, @child hierarchyid, @high hierarchyid, @cnt integer set @parent = '/ 1 /' set @child = @ parent.GetDescendant (zero, NULL) SET @cnt = 0 WHILE (@@ ERROR = 0) BEGIN SET @cnt = @cnt + 1 Print Cast (@CNT AS varchar (10)) + ':' child.ToString () SET @high = @Parent.GetDescendant (@child, @high) SET @child = @ Parent.GetDescendant (@child, @high) END
hierarchy
is your package index, then this page will be killing display. If you are trying to rank nodes by parents, use instead of ranking columns ; It's easy to and more efficient after a system
than you insert
for where the transaction isolation and worry about others Choose what to do during such a headache.
Comments
Post a Comment