Performance:1 Trigger on INSERT & UPDATE or 2 triggers with one each on INSERT && UPDATE

StackOverflow https://stackoverflow.com/questions/12958881

  •  08-07-2021
  •  | 
  •  

I have a scenario where i need to Implement triggers for Update and Insert DML Operations. But,I am in a fix whether to implement Update and Insert in one Trigger or create 2 triggers for Insert and Delete respectively....

Also,please note that in my case I might need to execute multiple insert commands at one go...

Please suggest me for the better option with regards to performance as CODE OPTIMAZATION is a big issue in my project(i mean my client..!!))..

有帮助吗?

解决方案

I would suggest to create a single Trigger as to create a separate trigger for the UPDATE and the INSERT would become maintenance problem. There is no such performance issue regarding the code optimization.
For performance optimization point of view you can check something like IF EXISTS.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top