1

I have a trigger defined on a table, which for every insert, update or delete, will populate another table. Will this have any performance impact on the overall database functioning? Are there any other alternatives for triggers which can have better performance?

1 Answer 1

3

Will it impact performance? Yes. The database will have more work to do so performance will be impacted. But does it matter? Depending upon what your trigger is doing, your table structures, and the base load on the database the impact may be unnoticeable to your end users. If you really need to worry about this then I'd suggest profiling the database with and without the trigger to determine if the cost is too high for what it provides.

As for alternatives, you didn't mention what DB you were using, some DBs like Postgresql provide a rules system that is implemented differently than their trigger system which could perform differently for your use case. Again you'd have to profile the system and see which performs better for your exact needs.

Depending upon your use case and your data another alternative might be to replace the trigger with a small application that runs during non-peak usage hours to provide the same functionality.

I want to mention though that if everything is working and the end users are happy with the system performance then I wouldn't worry about the impact of the triggers at this time. Seeking better performance for the sake of better performance can be a waste of time and resources if it's not addressing a current or foreseen issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .