|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 12:37 AM
Points: 730,
Visits: 1,708
|
|
Hi,
I would like to know the difference between disabling and dropping a trigger. To me, Trigger is basically coupled with transaction hence write/reads entry from the log for the action. If that is the case, disabling a trigger would only stop the read operation however the write happens to the transaction log. For a big table with more transactions(updates/delete/insert), it would be great if we can drop the trigger instead of disabling so I can save the log file growth. So dropping a trigger would be the best one rather than disabling if it is not going to use in future.
Please correct me perhaps I am wrong on anything.
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Tuesday, March 05, 2013 2:20 PM
Points: 63,
Visits: 106
|
|
| If you aren't going to use the trigger anymore, drop it. If you do plan on using it in the future, I would disable it. Another alternative is to script the trigger out and recreate it/drop it with a script or job.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 10:22 AM
Points: 1,037,
Visits: 7,695
|
|
Whether you have triggers on a table or not has no bearing on whether transactions are written to the transaction log. All transactional operations are logged (in all recovery models) so you will not gain anything tangible by dropping vs disabling a trigger.
Also, triggers do not operate asyncronously, somehow mining the transaction log. They will be fired for each relevant DML statement as part of the same transaction.
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 12:37 AM
Points: 730,
Visits: 1,708
|
|
Thanks for your comment!!!
Am really looking for an answer or confirmation as how the disabling of a trigger is working. As I mentioned, is this the way that it will log an entry in transaction log but it wont read from it or it wont write the entry at all if it is in disabled state?
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 10:22 AM
Points: 1,037,
Visits: 7,695
|
|
sqlchanakya (2/28/2011)
Am really looking for an answer or confirmation as how the disabling of a trigger is working. As I mentioned, is this the way that it will log an entry in transaction log but it wont read from it or it wont write the entry at all if it is in disabled state?
No, triggers have absolutely no effect on whether the original transaction gets logged to the transaction log.
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 12:37 AM
Points: 730,
Visits: 1,708
|
|
Could you plese check the below link and correct me where I interpreted wrongly...
http://sqlblogcasts.com/blogs/tonyrogerson/archive/2006/10/27/1248.aspx
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 10:22 AM
Points: 1,037,
Visits: 7,695
|
|
Interesting...
That is written for 2000 (this is the 2008 forum) - what it's saying is that because the inserted and deleted tables need to include all columns, not just the ones affected by the update, some operations may end up with increased logging information.
I've never heard of this before and I can't see any official reference that supports it, but it does make some sense. I suspect that the huge changes between 2000 and 2008 will have changed this one way or another, however I'll see if I can do some digging (if one of the heavy weights hasn't answered it definitively by then)
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 12:37 AM
Points: 730,
Visits: 1,708
|
|
Okei, In Paul Randal's blog, he mentioned for SQL 2005 or behind, they changed the way the trigger working. But I could not find how it works.
I would really appreciate if you could help me on the same as you said....I would also definitely look and share the same.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 10:22 AM
Points: 1,037,
Visits: 7,695
|
|
| So, to clarify, which version of SQL Server are you using?
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 12:37 AM
Points: 730,
Visits: 1,708
|
|
| SQL Server 2008; however 80 compatibility ....
|
|
|
|