question

lad_ket avatar image
lad_ket asked

Are Triggers Execute in parallel?

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

By Ketan

sql-server-2008trigger
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kristen avatar image Kristen ♦ commented ·
Triggers are executed sequentially, as you found out. Please edit to clarify what your question is.
0 Likes 0 ·
Kristen avatar image Kristen ♦ commented ·
You need to explain what the 1000+ triggers are doing (an example or two should do). I think most people here probably cannot begin to understand what they might be doing - me included! Are you sending the Story to different sites, or publishers, or editors, or something else?
0 Likes 0 ·
TG avatar image
TG answered

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?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Peso avatar image
Peso answered

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.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

AjarnMark avatar image
AjarnMark answered

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.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.