Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand Waiting for commit lock in MySQL

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to understand Waiting for commit lock in MySQL". In daily operation, I believe many people have doubts about how to understand Waiting for commit lock in MySQL. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the questions of "how to understand Waiting for commit lock in MySQL"! Next, please follow the editor to study!

Where the logic of sql_safe_updates is controlled, the source code is as follows:

Bool multi_delete_precheck (THD * thd, TABLE_LIST * tables) {SELECT_LEX * select_lex= thd- > lex- > select_lex; TABLE_LIST * aux_tables= thd- > lex- > auxiliary_table_list.first; TABLE_LIST * * save_query_tables_own_last= thd- > lex- > query_tables_own_last; DBUG_ENTER ("multi_delete_precheck"); / * sql_yacc guarantees that tables and aux_tables are not zero * / DBUG_ASSERT (aux_tables! = 0) If (check_table_access (thd, SELECT_ACL, tables, FALSE, UINT_MAX, FALSE) DBUG_RETURN (TRUE); / * Since aux_tables list is not part of LEX::query_tables list we have to juggle with LEX::query_tables_own_last value to be able call check_table_access () safely. * / thd- > lex- > query_tables_own_last= 0; if (check_table_access (thd, DELETE_ACL, aux_tables, FALSE, UINT_MAX, FALSE) {thd- > lex- > query_tables_own_last= save_query_tables_own_last; DBUG_RETURN (TRUE);} thd- > lex- > query_tables_own_last= save_query_tables_own_last If ((thd- > variables.option_bits & OPTION_SAFE_UPDATES) & &! select_lex- > where_cond ()) / / check whether the parameter is enabled and there is no where condition {my_message (ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, ER (ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF (0)); / / error DBUG_RETURN (TRUE);} DBUG_RETURN (FALSE);}

Briefly record the function:

Update and delete operation statements without where and limit conditions cannot be executed without SQL_SAFE_UPDATES = 1, even update and delete without key column conditions without where and limit conditions.

When SQL_SAFE_UPDATES = 0, the update and delete operations will be executed smoothly.

At this point, the study of "how to understand Waiting for commit lock in MySQL" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report