Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Triggers Expand / Collapse
Author
Message
Posted Monday, February 28, 2011 5:12 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Today @ 6:13 AM
Points: 731, Visits: 1,941
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.
Post #1070431
Posted Monday, February 28, 2011 5:47 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued 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.
Post #1070442
Posted Monday, February 28, 2011 5:59 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 8:31 AM
Points: 1,206, Visits: 9,330
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.
Post #1070449
Posted Monday, February 28, 2011 5:59 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Today @ 6:13 AM
Points: 731, Visits: 1,941
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?
Post #1070451
Posted Monday, February 28, 2011 6:05 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 8:31 AM
Points: 1,206, Visits: 9,330
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.
Post #1070454
Posted Monday, February 28, 2011 6:11 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Today @ 6:13 AM
Points: 731, Visits: 1,941
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
Post #1070457
Posted Monday, February 28, 2011 6:26 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 8:31 AM
Points: 1,206, Visits: 9,330
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)
Post #1070464
Posted Monday, February 28, 2011 6:31 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Today @ 6:13 AM
Points: 731, Visits: 1,941
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.
Post #1070466
Posted Monday, February 28, 2011 6:35 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 8:31 AM
Points: 1,206, Visits: 9,330
So, to clarify, which version of SQL Server are you using?
Post #1070469
Posted Monday, February 28, 2011 9:00 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Today @ 6:13 AM
Points: 731, Visits: 1,941
SQL Server 2008; however 80 compatibility ....
Post #1070605
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse