Subject Re: [Firebird-Architect] "COMPUTED BY" obsolete?
Author Jim Starkey
plinehan wrote:
> Hi again, (if wrong group, please advise)
>
>
> with the advent of cheap diskspace, has the
> COMPUTED BY clause not become obsolete?
>
> I mean, we now create shadow fields with
> the calculation already done - i.e. if
> before it was "(Field3) COMPUTED BY Field1 + Field2",
> could you not have an on update trigger
> SET VALUE (for Field3) = Field1 + Field2?
>
> What are the advantages of a COMPUTED BY field?
>
>

Well, let's see:

1. It's cheaper to compute a value than to fetch it
2. Storing it would require some very complicated code determine when
recomputation would be required
3. Recomputation would entail mass updates, incurring very expensive
mass updates
4. Mass updates induce nasty concurrency issues
5. Storing a computed values increases the record size, reducing the
number of records on page, increasing page reads,decreasing
performance

Other than that, not much.

--
Jim Starkey
NimbusDB, Inc.
978 526-1376



[Non-text portions of this message have been removed]