开发者

Identifying who makes a lot of INSERT requests in MySQL

开发者 https://www.devze.com 2022-12-21 06:33 出处:网络
Recently, I noticed that my MySQL server processes a lot of INSERT\'s. How can I detect user or DB on which is this activivty??

Recently, I noticed that my MySQL server processes a lot of INSERT's. How can I detect user or DB on which is this activivty??

开发者_Python百科
insert    33 k    97.96 k 44.21%


SHOW FULL PROCESSLIST will return every connection, user, and query currently active, if you have the PROCESS permission. That's more for immediate problems, but it has the least overhead.

If you use query logging, then instead of the regular query log (it can slow your server down noticeably) use the binary log to keep it minimal. It only tracks actions that change tables, like CREATE/DROP/ALTER and INSERT/UPDATE/REPLACE.


What you should log periodically (once a minute):

  1. SHOW FULL PROCESSLIST;
  2. SHOW GLOBAL STATUS;

with slow log enabled this will give you huge chance that any question can be solved.

If you have binary logging enabled you can check time/user who inserted rows.
If you have general log enabled then everything is logged.


Look in your query logs. This will show every connect into MySQL, and show every command that they execute.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号