相关文章推荐
想表白的楼房  ·  MySQL :: MySQL 8.4 ...·  2 月前    · 
淡定的香烟  ·  Entity Framework Core ...·  2 月前    · 
憨厚的黑框眼镜  ·  MySQL :: MySQL 8.4 ...·  2 月前    · 
温暖的芒果  ·  Upgrade from containers·  2 月前    · 
近视的苦瓜  ·  Oracle、Teradata和MySQL语 ...·  2 月前    · 
想出国的钱包  ·  TypeScript Instanceof ...·  1 年前    · 
讲道义的烈酒  ·  python ...·  1 年前    · 
苦恼的椰子  ·  Semi-Annual ...·  2 年前    · 

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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.

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

Could you also post results of A) SHOW GLOBAL VARIABLES LIKE '%event%; and B) SHOW GLOBAL STATUS LIKE '%event%'; for analysis and confirmation nothing EVENT driven has been used since instance start. – Wilson Hauck Nov 23, 2020 at 14:07 @HamzaAZIZ I can't remember exactly, but I'm guessing I was looking at htop or something on the command line and traced it to the event scheduler process. – BadHorsie Sep 21, 2021 at 12:36

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:

SET @@global.event_scheduler = 0;

You also want to add:

event_scheduler = OFF

to your my.cnf file to prevent it starting after a reboot.

Does disabling of it make any difference in performance while insertion/updation/SELECTion is being done in multiple threads? – Volatil3 Oct 20, 2022 at 14:05

Thanks for contributing an answer to Database Administrators Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.