溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

RR模式下insert..selcet sending data狀態(tài)是怎樣的

發(fā)布時間:2021-09-13 16:34:47 來源:億速云 閱讀:113 作者:柒染 欄目:MySQL數(shù)據(jù)庫

RR模式下insert..selcet sending data狀態(tài)是怎樣的,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

例如:
RR模式下insert..selcet sending data狀態(tài)是怎樣的

其中的sending data是什么意思。隔離級別為RR,語句為insert..select。

二、關于sending data

以前就說過這個問題,實際上sending data可能包含如下:

  • Innodb 層數(shù)據(jù)的定位返回給MySQL

  • Innodb 層數(shù)據(jù)的查詢返回給MySQL 層

  • Innodb 層數(shù)據(jù)的修改(如果是insert..select)

  • Innodb 層加鎖以及等待

  • 等待進入Innodb層(innodb_thread_concurrency參數(shù))

  • MySQL 層發(fā)送數(shù)據(jù)給客戶端

三、RR模式下對于insert..selcet 處于 sending data的原因總結(jié)

  • RR模式下insert..select的select表會上S行鎖,如果這行處于X鎖則會出現(xiàn) sending data狀態(tài)
    RR模式下insert..selcet sending data狀態(tài)是怎樣的
    RR模式下insert..selcet sending data狀態(tài)是怎樣的

  • insert..selcet中insert記錄如果處于堵塞(唯一性檢查)狀態(tài)會處于 sending data狀態(tài)
    RR模式下insert..selcet sending data狀態(tài)是怎樣的

RR模式下insert..selcet sending data狀態(tài)是怎樣的

  • 整個過程如果需要操作的數(shù)據(jù)量較大,處于sending data狀態(tài)。

四、每行數(shù)據(jù)處理方式

    929 T@4: | | | | | | THD::enter_stage: 'Sending data' /cdh/mysqldebug/percona-server-5.7.29-32/sql/sql_executor.cc:202
    930 T@4: | | | | | | >PROFILING::status_change
    931 T@4: | | | | | | <PROFILING::status_change 391
    932 T@4: | | | | | | info: Sending data
    933 T@4: | | | | | | >do_select
    934 T@4: | | | | | | | >sub_select
    935 T@4: | | | | | | | | >init_read_record
    936 T@4: | | | | | | | | | info: using rr_sequential
    937 T@4: | | | | | | | | | >ha_rnd_init
    938 T@4: | | | | | | | | | | >change_active_index
    939 T@4: | | | | | | | | | | | >innobase_get_index
    940 T@4: | | | | | | | | | | | <innobase_get_index 10117
    941 T@4: | | | | | | | | | | <change_active_index 10241
    942 T@4: | | | | | | | | | <ha_rnd_init 3111
    943 T@4: | | | | | | | | | >innobase_trx_init
    944 T@4: | | | | | | | | | <innobase_trx_init 3109
    945 T@4: | | | | | | | | <init_read_record 349
    946 T@4: | | | | | | | | >handler::ha_rnd_next
    947 T@4: | | | | | | | | | >rnd_next
    948 T@4: | | | | | | | | | | >index_first
    949 T@4: | | | | | | | | | | | >index_read
    950 T@4: | | | | | | | | | | | | >row_search_mvcc
    951 T@4: | | | | | | | | | | | | | >row_sel_store_mysql_rec
    952 T@4: | | | | | | | | | | | | | | >row_sel_store_mysql_field_func
    953 T@4: | | | | | | | | | | | | | | <row_sel_store_mysql_field_func 3275
    954 T@4: | | | | | | | | | | | | | | >row_sel_store_mysql_field_func
    955 T@4: | | | | | | | | | | | | | | <row_sel_store_mysql_field_func 3275
    956 T@4: | | | | | | | | | | | | | <row_sel_store_mysql_rec 3465
    957 T@4: | | | | | | | | | | | | <row_search_mvcc 6574
    958 T@4: | | | | | | | | | | | <index_read 10042
    959 T@4: | | | | | | | | | | <index_first 10430
    960 T@4: | | | | | | | | | <rnd_next 10531
    961 T@4: | | | | | | | | <handler::ha_rnd_next 3172
    962 T@4: | | | | | | | | >evaluate_join_record
    963 T@4: | | | | | | | | | enter: join: 0x7ffef8019970 join_tab index: 0 table: testlock cond: 0x0
    964 T@4: | | | | | | | | | counts: evaluate_join_record join->examined_rows++: 1
    965 T@4: | | | | | | | | | >end_send
    966 T@4: | | | | | | | | | | >Query_result_insert::send_data
    967 T@4: | | | | | | | | | | | >fill_record
    968 T@4: | | | | | | | | | | | | >Item_field::save_in_field_inner
    969 T@4: | | | | | | | | | | | | <Item_field::save_in_field_inner 6720
    970 T@4: | | | | | | | | | | | | >Item_field::save_in_field_inner
    971 T@4: | | | | | | | | | | | | <Item_field::save_in_field_inner 6720
    972 T@4: | | | | | | | | | | | <fill_record 9801
    973 T@4: | | | | | | | | | | | >write_record
    974 T@4: | | | | | | | | | | | | >init_alloc_root
    975 T@4: | | | | | | | | | | | | | enter: root: 0x7fffe8e48c20
    976 T@4: | | | | | | | | | | | | <init_alloc_root 100
    977 T@4: | | | | | | | | | | | | >COPY_INFO::set_function_defaults
    978 T@4: | | | | | | | | | | | | <COPY_INFO::set_function_defaults 135
    979 T@4: | | | | | | | | | | | | >handler::ha_write_row
    980 T@4: | | | | | | | | | | | | | >ha_innobase::write_row
    981 T@4: | | | | | | | | | | | | | | >row_ins
    982 T@4: | | | | | | | | | | | | | | | row_ins: table: test/testbb
    983 T@4: | | | | | | | | | | | | | | | >row_ins_index_entry_step
    984 T@4: | | | | | | | | | | | | | | | | >row_ins_clust_index_entry
    985 T@4: | | | | | | | | | | | | | | | | | >row_ins_clust_index_entry_low
    986 T@4: | | | | | | | | | | | | | | | | | | >btr_cur_search_to_nth_level
    987 T@4: | | | | | | | | | | | | | | | | | | <btr_cur_search_to_nth_level 2092
    988 T@4: | | | | | | | | | | | | | | | | | | >thd_report_row_lock_wait
    989 T@4: | | | | | | | | | | | | | | | | | | <thd_report_row_lock_wait 4280
    990 T@4: | | | | | | | | | | | | | | | | | <row_ins_clust_index_entry_low 2692
    991 T@4: | | | | | | | | | | | | | | | | <row_ins_clust_index_entry 3337
    992 T@4: | | | | | | | | | | | | | | | <row_ins_index_entry_step 3619
    993 T@4: | | | | | | | | | | | | | | <row_ins 3763
    994 T@4: | | | | | | | | | | | | | | >thd_mark_transaction_to_rollback
    995 T@4: | | | | | | | | | | | | | | <thd_mark_transaction_to_rollback 4147
    996 T@4: | | | | | | | | | | | | | <ha_innobase::write_row 8895
    997 T@4: | | | | | | | | | | | | <handler::ha_write_row 8565

及RR模式下insert select的邏輯大概為查詢一行加鎖(RC下沒有加鎖步驟)一行插入一行,直到所有行處理完成。整個過程處于’Sending data’狀態(tài)下面。因此insert select和普通的insert操作有較大的區(qū)別。

關于RR模式下insert..selcet sending data狀態(tài)是怎樣的問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業(yè)資訊頻道了解更多相關知識。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI