SQL Server Power Search - Get More Relevant Results

SQL Triggers - Design for Performance

SQL Triggers are a powerful tool, but be careful not to overuse them.

I have just finished investigating a performance problem for a client, and one of the contributing factors was inefficient use of triggers.




A trigger is useful in the following situations:

Situations where triggers should definitely be avoided:

The basic idea is that you should only use a trigger if the code is extremely lightweight, and has a negligible impact on transaction duration.

Some ways of speeding up a trigger are:

So what is my final advice?

Well personally I have never seen a situation where triggers are the only option. I avoid them at all costs, but if you really do have no alternative you should design them with performance in mind. A few badly thought out triggers can turn an otherwise well designed system into something the users never stop complaining about.

 
Not found what you're looking for?
Use this search box. It is tuned for SQL Server searches. Try it and see!



Do you have a question about SQL Server? Would you like to answer a question?

Go to the SQL FAQ to get started.