Re: Question on Structuring Product Attributes

From: <hugokornelis_at_gmail.com>
Date: Sat, 9 Feb 2013 01:45:10 -0800 (PST)
Message-ID: <fc347766-d6b5-42b1-8321-7e21a3952007_at_googlegroups.com>


Derek:

Calling someone's arguments insane is a very convenient way to avoid having to address them. Most commonly used by people who have no other refute.

Everyone else:

This topic presents two possible methods to implement a supertype/subtype hierarchy in a relational database. One based on extra UNIQUE and FOREIGN KEY constraints, the other one based on CHECK constraints that call a user-defined function. Both methods have the same goal: presenting details in a subtype that doesn't correspond to the type indicator in the supertype table (e.g. providing book details for a product marked as CD). Both methods achieve that goal, provided you put in the effort to adapt the code to your specific platform. This effort can vay from minor code changes in most cases, to major additions in some cases.

Derek claims that his method is better. He bases this observation on counting indexes. He is so convinced of the logic of his arguments that actually testing the two alternatives would be a waste of time.

I claim that both methods have their merits. Which one is better depends on how specific platforms implement UNIQUE and FOREIGN KEY constraints, how specific platforms implement CHECK constraints that call a user-defined function, and (most important) on what metrics are relevant in your situation.

If you ever have to implement such a scenario, here are your options:

  1. Pick the one you like best, based on whatever reason is important to you. Don't consider the alternative. This guarantees that you'll save some research effort, but not much else.
  2. Set up a test environment and implement both. Test both (don't forget to include a test case where the type indicator in the supertype table changes when is present in the subtype table - that change should be rejected). Then define what performance characteristics are important in your situation and set up and run a test with a representative load to measure the relevant performance characteristics.

Derek also made a lot of explicit and implicit statements about my mental condition, my intelligence, my reading ability, my intentions for participating in this discussion, and so on. I trust that the readers in this group are smart enough not to falll for this fallacy.

Cheers,
Hugo Received on Sat Feb 09 2013 - 10:45:10 CET

Original text of this message