Subject | Re: Store Sum Value in Table |
---|---|
Author | Adam |
Post date | 2006-04-01T23:26:30Z |
> I'm just considering the COMPUTED BY field versus SP when calculatingThis has been my experience. Computed fields are great for fields
> totals, from the performance pov and also from altering structure
> when/if needed
> I think that using COMPUTED BY SUM(.... FROM detailtable WHERE ...) is
> slower than a SP.
where the value can be calculated by the other fields in the current
record even using a (well written) UDF call. As soon as you introduce
a different table to the computed field, the performance heads south
very quickly. I was testing this feature during the RC phase of FB
1.5.0 so things may have improved.
Our work-around was to use triggers to update the total in the master
record when the master record changes, and the triggers on the detail
records cause this to happen.
In our case, it is impossible (nonsense from a business perspective)
for two concurrent transactions to update the same master record or
detail records pertaining to that master record. If it is possible
from a business perspective to have two concurrent transactions
changing detail records for the same master record, then you will need
to use a different approach.
Adam