Home  >  Q&A  >  body text

SQL slow query causes CPU memory to reach 100%, what should I do?

It is said that there are a large number of slow query records in the database, and the execution time is too long, resulting in resource exhaustion. What should I do? Delete mysql-bin.XXXXXXX and mysql-bin.XXXXXXX in mysql-bin.index. Delete mysql-slow.log and rebuild log-bin=mysql-binbinlog_format=mixedserver-id = 1expire_logs_days = 10slow_query_log=0slow. -query-log-file=/www/server/data/mysql-slow.loglong_query_time=1#log_queries_not_using_indexes=on

赵泽鑫赵泽鑫715 days ago1049

reply all(3)I'll reply

  • 大瓶可乐@php.cn

    大瓶可乐@php.cn2022-08-11 11:41:17

    See if we can create an index to optimize

    reply
    0
  • 赵泽鑫

    Please tell me how to create an index, thank you.

    赵泽鑫 · 2022-08-11 11:46:00
    lx

    Baidu searches for commands on how to create an index for a data table, or create it directly with a tool

    lx · 2022-08-12 14:08:15
  • Cancelreply