Are there any recommendations / preferences / best practices / benefits (maintenance/performance/etc) on triggers on Subtable Mains vs on the Parent table of the subtable?
Thank you.
Are there any recommendations / preferences / best practices / benefits (maintenance/performance/etc) on triggers on Subtable Mains vs on the Parent table of the subtable?
Thank you.
I don’t believe there’s any best practice for triggers on subtable mains vs the parent table. Depends on your use case. If the trigger is put on the parent record, you’ll have to loop through the subtable each time, and won’t have as much insight each subtable main record has undergone (was it inserted, updated…). A trigger on the parent could be more performant if you’re treating all subtable main records the same. If the trigger is on the subtable main, you’ll have more insight on what mutation each subtable main record had just undergone. This approach could be more performant if the subtable main records are not interacted with as much as the parent/how often you expect the trigger to be called.
The main focus around this question was related to performance. One use case/consideration is when you have a number of subtables on a table - I was wondering about performance on that, but your response covers it and things to keep in mind/consider. Thank you!