Subject | Computed field |
---|---|
Author | Eric |
Post date | 2006-06-06T17:35:40Z |
Hello,
I'm wondering what is better in performance - against database design..
I have an order table (master) in which I calculate the totals of the
lines table (detail)
What is better?
1. add a computed field to the order table and calculate it by a (Select
Qty * price where MasterID = DetailID)
or
2. compute the field through a stored procedure in which the totals
where calculated.
The last option has the advantage the select queries are faster, but the
"Total-amount" field is redundant in the database and the chance of
errors is bigger...
Thanks,
Eric
I'm wondering what is better in performance - against database design..
I have an order table (master) in which I calculate the totals of the
lines table (detail)
What is better?
1. add a computed field to the order table and calculate it by a (Select
Qty * price where MasterID = DetailID)
or
2. compute the field through a stored procedure in which the totals
where calculated.
The last option has the advantage the select queries are faster, but the
"Total-amount" field is redundant in the database and the chance of
errors is bigger...
Thanks,
Eric