Subject | RE: [ib-support] calculated fields |
---|---|
Author | Alan McDonald |
Post date | 2003-04-20T13:06:47Z |
depends on how your client is working with the total. I find that if you use
a trigger to calc it, then you need to retrieve the answer again to the
client to show this answer. If you calc it both at the server and client,
this leads to the possibility of a mismatch in answer depending on the type
of calc but certainly a duplication fo calculation server and client is
required if you want to show your user the answer before you save it and
have the server calc it again.
I normally try to calc it on the way out of the server (as per calc field)
or a subselect calculation if that's possible. I also try (depends on
design) to never store the answer on the server, I always calc it when I
need it.
Some calculations are too complex for a simple select calc so I get my
client to do it and never get the server to do it or store the answer to it.
Yes it will be calc'ed everytime you select it so a select * can be costly.
Does your design really ever need a select * at all?
Alan
-----Original Message-----
From: Ulrich [mailto:ulrich.groffy@...]
Sent: Sunday, 20 April 2003 6:54 PM
To: ib-support@yahoogroups.com
Subject: [ib-support] calculated fields
Hello,
not to calculate the amount of every bill stored in a table on every client
again and again, I thought about to calculate the amount of every stored
bill with a computed field. I do this with a stored procedure. I defined the
computed field as :
COMPUTED BY (((select AMOUNT from CALC_AMOUNT(BILL_ID))))
where CALC_AMOUNT(BILL_ID) is my stored procedure
It works fine, but if I rely on this method for my future development, my
question is : Is there a serious time-penalty, and when will it arise? The
table of bills will contain something between 10.000 to 50.000 records. The
table of the bill positions will contain between 100.000 and 1.000.000
records.
So, if I make a (select * from bill) the computed fields inside the bill
table will be calculated for every record??
The second possibility I thought about is, to have a real (I mean -not
computed) field inside the bill table, which I fill with the bill amount
(with the help of a stored procedure) only when the bill amount really
changes (with an on_update trigger on the bill table)
Any comments, or suggestions?
Ulrich
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
a trigger to calc it, then you need to retrieve the answer again to the
client to show this answer. If you calc it both at the server and client,
this leads to the possibility of a mismatch in answer depending on the type
of calc but certainly a duplication fo calculation server and client is
required if you want to show your user the answer before you save it and
have the server calc it again.
I normally try to calc it on the way out of the server (as per calc field)
or a subselect calculation if that's possible. I also try (depends on
design) to never store the answer on the server, I always calc it when I
need it.
Some calculations are too complex for a simple select calc so I get my
client to do it and never get the server to do it or store the answer to it.
Yes it will be calc'ed everytime you select it so a select * can be costly.
Does your design really ever need a select * at all?
Alan
-----Original Message-----
From: Ulrich [mailto:ulrich.groffy@...]
Sent: Sunday, 20 April 2003 6:54 PM
To: ib-support@yahoogroups.com
Subject: [ib-support] calculated fields
Hello,
not to calculate the amount of every bill stored in a table on every client
again and again, I thought about to calculate the amount of every stored
bill with a computed field. I do this with a stored procedure. I defined the
computed field as :
COMPUTED BY (((select AMOUNT from CALC_AMOUNT(BILL_ID))))
where CALC_AMOUNT(BILL_ID) is my stored procedure
It works fine, but if I rely on this method for my future development, my
question is : Is there a serious time-penalty, and when will it arise? The
table of bills will contain something between 10.000 to 50.000 records. The
table of the bill positions will contain between 100.000 and 1.000.000
records.
So, if I make a (select * from bill) the computed fields inside the bill
table will be calculated for every record??
The second possibility I thought about is, to have a real (I mean -not
computed) field inside the bill table, which I fill with the bill amount
(with the help of a stored procedure) only when the bill amount really
changes (with an on_update trigger on the bill table)
Any comments, or suggestions?
Ulrich
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/