Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 512013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:16:34+00:00 2026-05-13T07:16:34+00:00

Apologies for the less than ideal title; had a hard time coming up with

  • 0

Apologies for the less than ideal title; had a hard time coming up with something.

Three entities: Products, Clients and Client_Product_Authorization.

A Client has access to many Products.

A Product is accessed by many Clients.

A Client_Product_Authorization authorizes a Client to access a Product.

We have 100,000+ Products (virtual goods) and managing Client_Product_Authorizations becomes a very labor intensive task. So we have Products that is a container of other Products. Example:

Product X is a container for Products 1 through 2000.

So, by creating a Client_Product_Authorization granting a Client the Product X, we are indirectly providing for the client to access products 1 through 2000. Mind that product 1 might be contained in different container products (so, yes, it is a many-to-many self relationship).

Here is the entity level data model:

alt text

The advantage of this mechanism is that we can just change the composition of Product X (adding or removing other products) and it automatically adjusts the product list available to the clients authorized to Product X. Managing awarding access to our large product-base is a matter of selecting a few container products.

The disadvantage is that it now became harder (in terms of creating a SQL statement, because of the many-to-many self-relationship) to know what the Client is actually authorized to see (as in the individual non-container products). As in:

Product Z is a container for Product X and Product Y

Product X is a container for Products 1 through 2000

Product Y is a container for Products 2001 through 5000

What are the actual non-container products a client authorized to Product Z can see?

Products 1 through 2000 and 2001 through 5000.

I would like to make the list of non-container products a client is authorized for to be materialized in some way. So that questions like:

Should Client ABC be allowed to see Product 78?

OR

What products is Client ABC authorized to see?

can be easily responded with a query.

The goal is to make the job of software trying to determine the list of products accessible to a client a simple mechanism, instead of requiring a traversal through all container products, their sub-container products, etc etc etc.

Three questions:

a) Is there a better data-model for this scenario?

b) Is there a different mechanism to simplify the management of access authorization for this large set of products?

c) How would you go about making the obtention of the list of non-container products available to a client as simple as possible?

I appreciate the collective’s input. Thanks in advance!


Update: Limiting the number of nested products is not an option for business reasons.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:16:35+00:00Added an answer on May 13, 2026 at 7:16 am

    Since you’re using SQL 2005 you should have access to common table expressions (CTEs) which makes the recursion of finding the children of a product much easier. You might want to look into CTEs and see if that’s sufficient for what you’re doing.

    Also, I don’t recall this specific scenario and my copy of the book is at home, but Joe Celko wrote a very good book on modeling hierarchies and trees in an RDBMS. It’s probably worth looking into to see if there is a better model for this. He had a few rather ingenious ones for other scenarios that didn’t seem obvious at first, but which are very efficient. Even if there isn’t a direct match, some of the techniques which he uses might be useful.

    The model which you have is what’s referred to as the adjacency list model. Celko also shows how to model hierarchies using what are called the nested set model and the path enumeration model.

    The nested set model may seem a little complicated at first, but it’s actually simple in a way. It’s more expensive for updating, but selects from it are VERY fast compared to just about any other way to model hierarchies. You can find an abbreviated description of it here. Since a product can be contained in multiple trees you would have to adapt it slightly for your case.

    The path enumeration model basically just uses a delimited (or XML) string to list out the path to the row in question, starting at the root of the tree. You then use string (or XQuery) functions to find children of a parent, etc. As far as I know, it’s only really useful for trees, which have a single root, so I don’t think that you could use it in your case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Again, apologies for the poor title - very hard to describe. I used the
Firstly, apologies for the vague title, but I'm not sure exactly what I'm asking
I apologize for the terrible title...it can be hard to try to summarize an
Apologies for the horrible title. I spent 10 minutes trying to explain this in
Apologies for asking more or less the same question again. I just noticed that
Firstly, I'm a newbie to C# and SharePoint, (less than a month's experience) so
I've had quite a bit of experience with programming (three semesters teaching VBasic, C++,
Apologies for the horrible title but I've no idea how to describe this easily.
Apologies for vague title as i couldn't think what the name is. Basically creating
Apologies if any of what I'm about to say makes no sense or overlooks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.