Re: Is there a better way to do this?

From: Patrick Suppes <psuppes_at_lucent.com>
Date: Mon, 19 Apr 1999 12:49:13 -0600
Message-ID: <371B7AA9.135B9EFE_at_lucent.com>


Risking a lynching from the data normalization crowd, you could create and maintain a summary field on the master table. You could use triggers to manage the summary based upon activity on the detail table (insert, update, delete). Just update the total based upon the change caused by the individual update. This could save you an enormous amount of churn on your database, but it is built upon a number of assumptions.

  1. You never defined how order is determined. If order is a function of insert sequence, or you only allow inserting and deleting from the back end of the order, this will work. If you allow insertions into the series, or deletions from the series, scrap this suggestion.
  2. If you use tools that circumvent triggers (truncate, quick load), scrap this suggestion.
  3. If there is lots of change activity on the table, but this evaluation is only rarely needed, you probably want to scrap this suggestion. In this case, just recalculate the "complex result" at reporting time.

Patrick Suppes
psuppes_at_lucent.com

Johnson Chao wrote:

> Hello, :
> I have made a Master-detail relation for my two blocks for
> two tables ztable1 and ztable2:
> ...

> . Does anybody
> know if there is a better way to do it?
>
> thanks in advance.
>
> --
> Johnson Chao
> ctc Japan
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Mon Apr 19 1999 - 20:49:13 CEST

Original text of this message