Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Better one big trigger or many small?
"Carlos" <miotromailcarlos_at_netscape.net> wrote in message
news:1de5ebe7.0202260329.624b085b_at_posting.google.com...
> I am wondering about the benefits of creating one big trigger (i.e.
> AFTER INSERT, UPDATE OR DELETE) instead of creating many small
> triggers ( AFTER INSERT, AFTER INSERT, AFTER DELETE) per table.
> I think the performance will be better with the three small ones, but
> I'm not sure.
> Another side to concern is the amount of triggers (three or more per
> table), with the complications of maintenance for all of them.
>
> Advices will be appreciated.
>
> Thanks & regards from Spain.
>
That's an easy one - in tracking down problems, triggers are often
overlooked, so you want to make it as simple to grasp as possible. Figuring
out what 3 triggers did is much messier than looking at one bundle of code.
Especially when you have to also consider what order did the many triggers
fire in (i.e. which 'after insert' trigger fired first?)
What I have found works best - A single trigger that calls a db procedure
that is thoroughly commented. Very easy to read and maintain.
Received on Tue Feb 26 2002 - 05:56:57 CST