|
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
(comments are locked)
|
|
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. I think you can choose which one executes FIRST and which one LAST, or have I mis-remembered that?
Nov 16 '09 at 01:26 PM
Kristen ♦
(comments are locked)
|
|
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.
(comments are locked)
|
|
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? I agree. It sounds like the solution using Triggers has possibly been built because an alternative method coud not be found. Might be best to describe what the Triggers do and then maybe we can recommend a better method.
Oct 29 '09 at 10:25 AM
Kristen ♦
(comments are locked)
|


Triggers are executed sequentially, as you found out. Please edit to clarify what your question is.
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?