mysql> create table testin(id int
);query ok, 0
rows affected (2.38 sec)
mysql> insert into testin values(10
);query ok, 1
row affected (0.02 sec)
126 t@2: | thd::enter_stage: 'starting' /root/mysql5.7.14/percona-server-5.7.14-7/sql/conn_handler/socket_connection.cc:100
349 t@2: |
| || |
| thd::enter_stage: 'checking permissions' /root/mysql5.7.14/percona-server-5.7.14-7/sql/auth/sql_authorization.cc:843
359 t@2: |
| || |
| | thd::enter_stage:
'opening tables' /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_base.cc:
5719
1078 t@2: | |
| || thd::enter_stage: 'init' /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_insert.cc:470
1155 t@2: |
| || |
| | thd::enter_stage:
'system lock' /root/mysql5.7.14/percona-server-5.7.14-7/sql/lock.cc:
3211253 t@2: | |
| || thd::enter_stage: 'update' /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_insert.cc:663
1535 t@2: |
| || | thd::enter_stage:
'end' /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_insert.cc:
8811544 t@2: | |
| | thd::enter_stage:
'query end' /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_parse.cc:
5174
1603 t@2: | |
| | thd::enter_stage:
'closing tables' /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_parse.cc:
5252
1730 t@2: | |
| thd::enter_stage: 'freeing items' /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_parse.cc:5855
1793 t@2: |
| thd::enter_stage: 'cleaning up' /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_parse.cc:1884
1824 t@2: | thd::enter_stage:
'starting' /root/mysql5.7.14/percona-server-5.7.14-7/sql/conn_handler/socket_connection.cc:
100
query end
sql_cmd_insert::mysql_insert
>sql_cmd_insert::mysql_insert
>切換session狀態為 update
>進入插入邏輯
>handler::ha_write_row
>ha_innobase::write_row
>row_insert_for_mysql
>row_insert_for_mysql_using_ins_graph
>trx_start_if_not_started_xa_low
>trx_start_low 啟用事物,事物狀態由 not_active 變為 active
>row_ins_step
>row_ins
>row_ins_index_entry_step
>row_ins_index_entry
>row_ins_clust_index_entry
>row_ins_clust_index_entry_low
>btr_cur_search_to_nth_level 查詢定位資料
>btr_cur_optimistic_insert 進行樂觀插入
>btr_cur_ins_lock_and_undo
>trx_undo_report_row_operation
>trx_undo_page_report_insert 記錄insert的undo記錄
>trx_undo_page_set_next_prev_and_add
>trx_undof_page_add_undo_rec_log 記錄undo的redo log 入redo buffer
>page_cur_tuple_insert 進行insert 元組插入,及實際的插入操作
>page_cur_insert_rec_write_log 記錄插入的redo log 入redo buffer
>binlog_log_row
>write_locked_table_maps
>thd::binlog_write_table_map
>binlog_start_trans_and_stmt
>binlog_cache_data::write_event binlog event 寫入到 binlog cache
進入提交邏輯
mysql_execute_command
>切換session狀態為 query end
>trans_commit_stmt
>ha_commit_trans
>mysql_bin_log::prepare
>ha_prepare_low
>binlog_prepare 生成last_commit
>innobase_xa_prepare
>trx_prepare_for_mysql
>trx_prepare 轉換事物狀態為,事物狀態由 active 變為 prepare
>mysql_bin_log::commit
>mysql_bin_log::ordered_commit
>mysql_bin_log::process_flush_stage_queue
>ha_flush_logs
>plugin_foreach_with_mask
>flush_handlerton
>innobase_flush_logs
>log_buffer_flush_to_disk
>log_write_up_to
>log_group_write_buf innodb 組提交,確保redo落盤
>mysql_bin_log::flush_thread_caches
>binlog_cache_mngr::flush
>binlog_cache_data::flush binlog cache 進行flush到binlog檔案
>mysql_bin_log::sync_binlog_file fsync binlog檔案進行os快取落盤
>mysql_bin_log::process_commit_stage_queue
>ha_commit_low
>innobase_commit
>innobase_commit_low
>trx_commit_in_memory innodb 進行提交,事物狀態由 prepare 變為 not_active
啟用事物狀態由 not_active 變為 active
查詢定位資料
進行樂觀插入
MySQL 簡單insert 一秒原因排查
這個問題是來自一位朋友 春波,我通過pstack最終確認問題,涉及到兩個引數的設定,我將從原始碼進行解釋,如果有誤還請見諒。1 簡單插入需要1秒 語句截圖如下 耗時截圖如下 2 profile展示 實際上這裡的query end是乙個非常有用的資訊,基本確認是在order commit函式上的等待。...
乙個insert插入語句很慢的優化
1 insert建議 update表的時候,oracle需要生成redo log和undo log 此時最好的解決辦法是用insert,並且將表設定為nologging 當把表設為nologging後,並且使用的insert時,速度是最快的,這個時候oracle只會生成最低限度的必須的redo lo...
乙個簡單WebService
最近一直在弄介面方面的東西,今天想著學學c 怎麼建立webservice程式。因為自己從來沒有過c 的經驗所以後續還是得多學習 1 新建專案 2 選擇 空模板 3 右鍵 新增 新建項 選擇 web服務 4 寫好方法,右鍵執行 求和的方法 public int add int x,int y webm...