patternsqlModerate
MySQL event scheduler waiting on empty queue since server restarted 12 days ago
Viewed 0 times
scheduleragowaitingemptysincerestartedmysqlserverqueuedays
Problem
I noticed a process on the server which has been running for more than 12 days, which I think coincides with the last time MySQL was restarted.
There are no events, and I haven't attempted to created any.
This is actively using up to 8% of my server's CPU.
Is there a way of determining what this is, or why it was started? Will this try to run every time I restart MySQL? If so, what is it 'waiting' for and do I need to tweak my configuration at all to prevent this?
MySQL 8.0.21
mysql> SHOW FULL PROCESSLIST;
+---------+-----------------+-----------+------+---------+---------+------------------------+-----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+---------+-----------------+-----------+------+---------+---------+------------------------+-----------------------+
| 5 | event_scheduler | localhost | NULL | Daemon | 1098372 | Waiting on empty queue | NULL |
| 1774483 | root | localhost | NULL | Query | 0 | starting | SHOW FULL PROCESSLIST |
+---------+-----------------+-----------+------+---------+---------+------------------------+-----------------------+
2 rows in set (0.00 sec)There are no events, and I haven't attempted to created any.
mysql> SELECT * FROM information_schema.EVENTS;
Empty set (0.00 sec)This is actively using up to 8% of my server's CPU.
Is there a way of determining what this is, or why it was started? Will this try to run every time I restart MySQL? If so, what is it 'waiting' for and do I need to tweak my configuration at all to prevent this?
MySQL 8.0.21
Solution
The event_Scheduler is, as it's name suggests, a way to Schedule Events (in this case queries) to run in MySQL at a given time. It is simply waiting for an event to trigger it and tell it to do something. As you can see you have no events set up, so it will be waiting for a long time.
It is enabled by default, but can be disabled by running:
You also want to add:
to your my.cnf file to prevent it starting after a reboot.
It is enabled by default, but can be disabled by running:
SET @@global.event_scheduler = 0;You also want to add:
event_scheduler = OFFto your my.cnf file to prevent it starting after a reboot.
Context
StackExchange Database Administrators Q#280163, answer score: 12
Revisions (0)
No revisions yet.