Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Are Triggers Really that Bad or ....???

Re: Are Triggers Really that Bad or ....???

From: Karen <abvk_at_ureach.com>
Date: Fri, 26 Jul 2002 03:47:28 GMT
Message-ID: <3D40C61E.B37AC508@ureach.com>


I think there is no question of whether triggers affect performance; there is an overhead associated with running triggers, noticeable when compared to the time of running a single DML operation. There has to be, because Oracle has to do certain things to run a trigger, like make sure it is valid, locate its code in memory, setup plsql context for it and so forth. All these ops consume CPU cycles.

The right question is how much the triggers affect performance. Of course, it is dependent on the version of Oracle, on your system configuration, type, etc. When I was trying to benchmark the overhead of having a trigger for plain insert operation, I received 33% overhead for an empty trigger. That was Oracle 8.0 on an old HPUX box. This you can simply measure on your system by creating an empty trigger and firing DML against the table. Likely, the performance is much better but if you want to know...

However, as other posters noted, the business logic belongs to the server side, and hence, you have to have triggers. This is very right. You do want to have good logical design and put components where they belong.

The best question to ask is whether the cost of having triggers is really affecting your application's intended response time.

Regs
AK

Ronnie Yours wrote:

> Hi,
>
> I am facing a wierd situation here.
>
> We have a database with around 150-200 Tables and growing . Each Table has
> 4 columns in additional to the ones for the application, namely
> created_by, created_date,updated_by and updated_date.
> Now when writing the application code the developers were supposed to take
> care of the values in these fields. For example when a record is
> added/inserted the created_by and created_date fields are populated and when
> the records are updated the updated_by and updated_dates are
> populated/updated.
> But the issue is the developeres did not take care of this issue and one of
> the senior developers is suggesting that lets create triggers to implement
> this functionality.
>
> My suggestion was and is that lets change the code to take care of this but
> he doesnt agree. He says it will take more time to do that.
>
> Now I am in a dilemma.
>
> If we implement triggers how will they affect the prformance.
> If I should not implement triggers then how should I go about handling this
> situation and explain the same to my manager.
>
> Please Suggest
>
> Thanks
> Ronnie Yours
Received on Thu Jul 25 2002 - 22:47:28 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US