UPDATE statements are in “query end state”

前端 未结 3 352
庸人自扰
庸人自扰 2021-01-13 14:29

We recently upgraded mysql database which is running on mysql server version 5.5.8. After the upgrade sometimes we are seeing the simple upgrade staements taking more than 1

相关标签:
3条回答
  • 2021-01-13 14:40

    Suggestions:

    1) Check the size of your log files

    LINK: Lots of "Query End" states in MySQL, all connections used in a matter of minutes

    2) Make sure "id" has an index

    3) Look at various MySql tuning and configuration options. For example: innodb_flush_log_at_trx_commit = 0

    LINK: "query end" step very long at random times

    WARNING: consider carefully before disabling log flushing. Look here for more details:

    LINK: https://dba.stackexchange.com/questions/12611/is-it-safe-to-use-innodb-flush-log-at-trx-commit-2

    0 讨论(0)
  • 2021-01-13 14:41

    Try adding quotes to any value you use in the query as they were all strings. That helped me many times. For example:

    UPDATE Accounts SET IPadd = 'xx.xx.xx.xx' WHERE Id='xx';
    
    0 讨论(0)
  • 2021-01-13 15:02

    I've checked some solutions here and I came up to this link.

    Add this line (if it exists edit it):

    innodb_flush_log_at_trx_commit = 0
    

    in the /etc/my.cnf


    However

    On Pedro Werneck comment:

    Setting innodb_flush_log_at_trx_commit naively can be dangerous

    It's your choice if you're doing transactional queries to it.

    0 讨论(0)
提交回复
热议问题