Subject Re: [ib-support] do I need to compare in this trigger...
Author Ann W. Harrison
At 05:59 PM 4/10/2002 +0000, csswa wrote:
>for a trigger than silently prevents changes to a field before
>update, which is the speediest of these two:
>
>1. if new.pk <> old.pk then new.pk = old.pk
>2. new.pk = old.pk
>
>Is doing the comparison slower than simply doing version 2 every time?

Rather depends on how often you expect to find a change
to the primary key. If the answer is almost never, the
comparison wins. If the answer is most of the time, the
simple assignment wins. The answer is probably between
the two, and I'd go with the comparison. (but I doubt
that you could measure the difference.)

Regards,

Ann
www.ibphoenix.com
We have answers.