2

Not sure what session will be use for event execution. Will mysql always create new session or just reuse old while executing event ? what happens to user-defined variable ? what happen if different events use same user-defined variable( I know it is not good to use user-defined var here, but need to know what's the result).

some example code to explain a little bit:

CREATE EVENT myevent_a
ON SCHEDULE EVERY 1 minute
DO
  Set @a = ...
  UPDATE myschema.mytable SET mycol = @a;

CREATE EVENT myevent_b
ON SCHEDULE EVERY 1 minute
DO
  Set @a = ...
  UPDATE myschema.mytable SET mycol = @a;

will @a be read/write concurrently?

Jammy Lee
  • 1,496
  • 1
  • 14
  • 32

0 Answers0