Walmart Labs Interview Question | Triggers

Question

You notice a system uses a lot of triggers to enforce foreign key constraints, and the triggers are error-prone and difficult to debug. What changes can you recommend to reduce the use of triggers?

in progress 3
Dhruv2301 55 years 1 Answer 813 views Great Grand Master 0

Answer ( 1 )

  1. Triggers can cause performance issues if not written carefully and not enough developers are knowledgeable enough to write them well. This is part of where they get their bad rap.

    Triggers are often slower than other means of maintaining data integrity, so if you can use a check constraint, use that instead of a trigger.

Leave an answer

Browse
Browse