How to activate trigger after all voluminous inserts in mysql

I use mysql, and there are large inserts that go to my table. I doubt that if I create a trigger with an indication after insert, then the trigger is activated for everyone insert afterthat I do not want to do.

Is there a way to activate a trigger after all volume inserts are complete?

Any tips?

Thank.

+3
source share
3 answers

look here and see if you can implement this trick, which basically wraps the trigger in an if statement, a controlled variable that you can turn on and off

if (@DISABLE_TRIGER <> 1 ) then
#trigger body
end if;

and if you want to disable triggers for import only:

SET @DISABLE_TRIGER = 1;

#do imports

SET @DISABLE_TRIGER = 0;
+2

, , , . , , .

, , , , ( , mysql - ).

+1

( → <) , . , . (- , , -200?) , , if, , . . , , .

0

Source: https://habr.com/ru/post/1734882/


All Articles