Nested Set vs Adjacency for Hierarchy

  • I need to model an unlimited number of levels in a hierarchy with jagged branches for an element we call Types. The hierarchy will be queried both up and down very frequently, so performance is paramount. For example:

    Type A Type B

    Type AB Type AC Type BE Type BF

    TypeABD Type BG

    Type BH

    We have an element we call Products that can have one or more types assigned to it.

    Our expected queries would be:

    - setting the types for a product

    - retrieving the assigned types for a product

    - for the product's types, determine if a user specified type (or types) and it's children matches the product's types or any of the children of the product's types

    I need to find the most efficient way to do this in SQL2000. We try to avoid using views, prefering to use stored procedures instead.

    Any suggestions?

  • I know this is a really old post but did you ever get an answer for this?

    --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.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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