Is there any other alternative Insted of using 1000+ tigger??
We need to start 1000+ process (Select Query) Parallely,
We are working no MS SQL Server 2008 and a table called tblStory. We have lots of triggers (arround 1000) right now whenever a new story comes, we want to all triggers will fired and do some appropriate entry in tblUser table. but All triggers will fired like sequencially so have any way like 20 or 1000 triggers will execute at same time. so we will save time because 1000 triggers will take arround 1.5 mins. Approximate we have to come lots of stories in a minutes.
Question is How or What the way execute the all triggers at same time when inserting the new story ?
I am working with MS SQL 2008
I have around 1000+ Triggers on a single table,
Do all trigger fire in parallel, when I insert a record in that table?
Because I have written some time log information and based on that I found that all triggers are executed Sequentially
Triggers are ru sequentialy as the other pointed out, but you can not choose in which order they are run. Before you could add ";1" or ";2" but that has been deprecated.
answered Nov 16 '09 at 04:36 AM
I agree with Kristen's comment - triggers run sequentially. But I have to ask, 1000+ triggers on a single table ??? What possible purpose is that serving?
answered Oct 29 '09 at 09:21 AM
1000 triggers on a table sounds completely outrageous to me. With all those triggers, if any one of them fails, the INSERT of the story will also fail and all the other actions will be rolled back. That is a lot of room for things to go sideways.
Whatever those triggers are doing is probably better suited to either pre or post INSERT processing within a stored procedure. Or perhaps one trigger that logs a record into a processing table and a scheduled job that monitors the contents of the processing table and then takes the necessary additional actions.
answered Nov 18 '09 at 04:26 PM