mysql知識點歸納 事務篇

2022-09-07 08:48:13 字數 515 閱讀 1381

願歷盡千帆,歸來仍是少年

簡述何為事務:控制資料的一致性。

檢視當前資料庫事務隔離級別

select @@tx_isolation

查詢超過60s的事務

select * from information_schema.innodb_trx where time_to_sec(timediff(now(),trx_started)) > 60

事務隔離級別

讀未提交:別人改資料的事務尚未提交,我在我的事務中也能讀到。   -(產生髒讀)

讀已提交:別人改資料的事務已經提交,我在我的事務中才能讀到。   -(產生不可重複讀,解決髒讀)

可重複讀:別人改資料的事務已經提交,我在我的事務中也不去讀。   -(產生幻讀(insert), 解決不可重複讀)

序列:我的事務尚未提交,別人就別想改資料。          -(解決幻讀)

MYSQL 事務知識點

事務是乙個完整的業務邏輯單元,不可再分。例如 銀行轉賬,a b轉賬10000,需要執行兩條update語句。update t act set balance balance 10000 where actno act 001 update t act set balance balance 1000...

mysql知識點歸納 鎖(死鎖)

願歷盡千帆,歸來仍是少年 所遇問題 場景 create table user item id bigint 20 not null,user id bigint 20 not null,item id bigint 20 not null,status tinyint 4 not null,prim...

集合知識點歸納

集合 定義 長度可變的 儲存物件的容器 特點 長度可變,只能用來儲存引用型變數 list介面 有序的,允許重複的 實現類 arraylist 底層維護陣列,執行緒不安全的,高效的,查詢快,增刪慢 linklist 底層維護鍊錶,能夠模仿佇列結構,增刪快 查詢慢 堆疊特點 先進後出 push 將元素壓...