If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Triggers/Stored procedures

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-16-08, 09:19
citi citi is offline
Registered User
 
Join Date: Aug 2007
Posts: 45
Triggers/Stored procedures

Is it possible for a table to have more than one trigger? Each trigger would call its own stored procedure.

Does it make sense to have more than one trigger on a table?

Would this have an impact on performance?
Reply With Quote
  #2 (permalink)  
Old 01-16-08, 09:33
jsharon1248 jsharon1248 is offline
Registered User
 
Join Date: Apr 2007
Location: Chicago
Posts: 57
Yes; they're fired in the order that they're created.
Sometimes, but only you can decide.
Yes, so you'll need to determine if the cost is justified. The impact on performance depends on what the trigger/stored proc is doing.
Reply With Quote
  #3 (permalink)  
Old 01-16-08, 10:42
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
You also need to look at it from a maintenance point of view. Since you can only influence the order the triggers are fired in by when they are created, you might have a problem if one of them needs to be changed. Either you change the one and the firing order is now different, or you have to recreate all of them is the order you want. It would be much simpler to have just one trigger with the SP calls in the order you want.

Andy
Reply With Quote
  #4 (permalink)  
Old 01-16-08, 15:34
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
If the triggers are not too complex, you would just shift the problem from the trigger-creation to the stored procedure definition.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old 01-17-08, 09:01
jsharon1248 jsharon1248 is offline
Registered User
 
Join Date: Apr 2007
Location: Chicago
Posts: 57
And please do your homework before creating multiple triggers on 1 table. I worked at a client that prohibited triggers because their experience convinced them that DB2 triggers were performance killers. Seems some genious created 100, that's right, 100 triggers on a table each calling a stored procedure and then everybody wondered why everything slowed down. How this ever made it to production is a testament to the unstoppable force of idiocracy.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On