views:

98

answers:

2

I m really looking for some input and guidance here.

Suppose you need to model a financial trading system. This needs to be able to handle different products (eg Equities(Shares) / Commodities (Oil /Gold) and Fixed Income (Bonds)

Now each product has different characteristics

The way I think about this is to have one "Transactions" table with about ten columns to "Product" tables.

This allows me to answer queries like "Show me all transactions on date X" and also allows me to provide more specific information on the actual transactions.

Am I going about this the right way?

I guess an alternative would be to have one big daddy "Product" table which stored the union of all fields but which would be very sparse

What do you guys think

A: 

Just because the products have different characteristics, I don't think you should have 10 different foreign keys into different products tables.

I'd suggest a single transactions table and a single (master) products table. If the product differ significantly then it might be worth keeping the key and the common pieces of data in the master and then pushing the other fields into extension tables with a one-to-one relationship back to products. This avoids having nulls everywhere but still obeys normalisation rules.

Chris Simpson
Interesting - Why is this approach better??I would have thought having ten separate product tables gives you normalisation rather then one big kludgy product table ( I also see your approach of having a master product table and sub tables) but very little is in common
ChloeRadshaw
Well they are all products for one thing, and they can all be involved in transactions. If you ever want to return transactions showing more than one product, this will avoid unions. It also makes adding new product types in easier.
Chris Simpson
Once you get into the nitty gritty of these transactions commodities are not just a little bit different from equities which are vastly different from bond transactions. Even within equities gets/puts, options, rights issues transactions have almost nothing in common except the client number. These transactions are governed by many regulators with arcane rules regarding contracts, defaults, late payments, liabilities and interest calculations. You could put it into a single table but it would be a humungous mess.
James Anderson
A: 

I know you're looking for the how-to, but in reality you might want to take a look at persistance engines better geared for this (SunGard and Murex solutions come to mind). Traditional ORDBMS/RDBMSs are not as dynamic as your needs and crawl under the demands of high volume/high transactions.

Nissan Fan