Triggers on tables

  • Does the forum have any opinions on the use of one trigger (on update say) which contains all logic, compared to multiple triggers which are sub-divided on business rules for example?

    In other words, is there an overhead on having multiple triggers of the same type on the same table?

    Regards

    Simon

    UK

  • I've never measured to see, I imagine there must be a small amount of overhead associated with each trigger, so I can see in theory that having multiple triggers would be more expensive. I'd say it's more a matter of convienence and coding cleanly. For example, you might have a trigger that maintains a denormalized col along with one that does some data integrity type stuff - could be handy to disable one and leave the other one working. Not that you couldnt modify the trigger, just maybe easier to manage because of the way its packaged.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • I would think that each has to be loaded and fired seperately so yes a small (probably almost indetectable) amount of overhead would occurr. Plus then you have to check all your triggers when you go to make changes. It might be fun to test though to see what happens and what advantages it may offer.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply