4 Replies Latest reply: Apr 30, 2012 2:29 AM by Davin Fifield-Oracle RSS

    Performance impacts of attributes versus entities in data model design

    PhillipWharton
      I'm trying to understand the performance implications of two possible data model designs.

      Here's my entity structure:

      global > the person > the account > the option

      Typically at runtime I instantiate one person, one account, and five option 's.

      There are various amounts determined by the person's age that need to be assigned to the correct option.

      Here are my two designs:

      Design one

      attributes on the person entity:
      the person's age
      the person's option 1 amount
      the person's option 2 amount
      the person's option 3 amount
      the person's option 4 amount
      the person's option 5 amount

      attributes on the option endity:
      the option's amount

      supporting rule table:
      the option's amount =
      the person's option 1 amount if the option is number 1
      the person's option 2 amount if the option is number 2
      the person's option 3 amount if the option is number 3
      the person's option 4 amount if the option is number 4
      the person's option 5 amount if the option is number 5

      Design two

      attributes on the person entity:
      the person's age

      attributes on the option entity:
      the option's amount
      the option's option 1 amount
      the option's option 2 amount
      the option's option 3 amount
      the option's option 4 amount
      the option's option 5 amount

      supporting rule table:
      the option's amount =
      the option's option 1 amount if the option is number 1
      the option's option 2 amount if the option is number 2
      the option's option 3 amount if the option is number 3
      the option's option 4 amount if the option is number 4
      the option's option 5 amount if the option is number 5

      Given the two designs, I can see what looks like an advantage for Design one in that at runtime you have less attributes (6 on the one pension member + 1 on each of 5 options =11) than Design two (1 on the one pension member + 6 on each of 5 options = 31), but I'm not sure. An advantage for Design two might be that the algorithm has to do less traversing of the entity structure: the supporting rule table finds everything for the option's amount on the option.

      Either way there is a rule table to determine the amounts:

      Design one
      the person's option 1 amount =
      2 if the person's age = 10
      5 if the person's age = 11
      7 if the person's age = 12, etc.

      Design two
      the option's option 1 amount =
      2 if the person's age = 10
      5 if the person's age = 11
      7 if the person's age = 12, etc.

      Here it looks like the rulebase would have to do more traversing of the entity structure for Design two.

      Which design is going to have better performance with a large amount of rules, or would it make a difference at all?
        • 1. Re: Performance impacts of attributes versus entities in data model design
          Ben Rogers
          Hi!

          In our experience you only need to think about things like this if you were dealing with 100s or 1000s of instances (typically via ODS). As you have a very low number, the differences will be negligible, and you should (usually) go with the solution which is the most similar to the source material or the business user's understanding. I also assume this is an OWD project? Which can be even better, since the inferencing is done incrementally when new data is added to the rulebase, rather than in one "big bang" like ODS.

          It looks like design 1 is the simplest to understand and explain. I'm just wondering why you need the option entity at all, since it seems like a to-one relationship? So the person can only have one option 1 amount, one option 2 amount etc, and there are only ever going to be (up to) 5 options...is that assumption correct? If so, you could just keep these as attributes on the person level without the need for instances. If there are other requirements for an option instance then of course, use them, but given the information here, the option entity doesnt seem to be needed. That would be the fastest of all :-)

          Either way, as the number of instances is so low, you should have nothing to worry about in terms of performance.

          Hope this helps! Write back if you have any more info / questions.
          Cheers,
          Ben
          • 2. Re: Performance impacts of attributes versus entities in data model design
            PhillipWharton
            Thanks Ben,

            I agree with you that the principle of isomorphism suggests sticking closely to source legislation, but in this case we have no relevant source legislation.

            The example was made simple so as to be clear without revealing client information. We are potentially dealing with 1000's of entities, so the impact is not trivial. Imagine processing multiple people, accounts, and options in one call. Web determinations is not being used.

            Can someone from R&D comment as to which algorithm would be better in terms of performance?
            • 3. Re: Performance impacts of attributes versus entities in data model design
              PhillipWharton
              More specifically, which data model at run time will have faster execution in the Nitro algorithm? :)
              • 4. Re: Performance impacts of attributes versus entities in data model design
                Davin Fifield-Oracle
                Even though you've provided a specific example, the performance will vary depending on other rules in the rulebase, the data and data types you use, and even to some extent on whether you deploy on .NET or Java, for example.

                It will also vary across versions as the engine is optimized based on experience, and as new features are added.

                So the short answer is: it depends! The best recommendation is to try it for your situation and see what differences in performance you see. It is likely the actual difference will be very little.