In a postgres database, say i have 3 tables, tb1, tb2 and tb3.
tb2 gets updated after insert on tb1 for each row using trigger T1, and tb3 gets updated after insert on tb1 for each statement using trigger T2.
my situation is I don't want tb3 to get updated until tb1 and tb2 finish updating, because she uses both.
now if I execute a query that inserts 10k lines on tb1 after the last line is inserted in tb1 the statement will end. and trigger T2 will fire. My question is, will T2 fire before tb2 gets its last 10k-th line or after?
If before, can you propose a solution so that tb3 doesn't get updated until after the two tables get both all the inserts finished?