storing averages in a separate data
Posted by: Radu Manuel Cirstoiu
Date: May 17, 2008 06:47AM

Hi
I'm writing an application(school project) which deals with a portfolio of stocks.
I have a table where I store transactions (stocks being bought or sold).
The Portfolio table would contain the averages of stocks from each transaction.
If you buy 100 stock A at price 3$, and then another 100 stock A at price 4$, then the data would look something like:

portfolio:

share_name volume average_price
---------------------------------
A 200 3.5$

transaction:

share_name volume price
--------------------------
A 100 3$
A 100 4$


Would that make sense for performance (not having to re-compute an user's portfolio over and over again) or would that be a big NO-NO? (I couldn't see how this would violate normalization)

Thanks!

Options: ReplyQuote


Subject
Written By
Posted
storing averages in a separate data
May 17, 2008 06:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.