總結下最近對MySQL數據庫的認識html
Q:在手動開啓事物後,commit失敗是否須要顯示的rollback?mysql
A:在網上查了很多資料,沒有查到明確的答案。問了身邊的朋友,朋友也不太瞭解,不過均表示顯示的rollback操做一下也沒錯,保險點。又去問了DBA,DBA說須要。sql
官網上對於事物的這塊是這麼講的,並無明確給出答案。數據庫
With
START TRANSACTION
, autocommit remains disabled until you end the transaction withCOMMIT
orROLLBACK
. The autocommit mode then reverts to its previous state.學習
13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntaxspa
Q:數據庫的事物隔離是什麼意思?code
A:數據庫有四種事物隔離,以前對其理解不深,最近我在一邊學習,一邊聯繫到業務中遇到的實際場景,我從官方文檔中摘了一段出來,想展開了解,請閱讀官方文檔,由於官方文檔是最權威的。htm
InnoDB
offers all four transaction isolation levels described by the SQL:1992 standard:READ UNCOMMITTED
,READ COMMITTED
,REPEATABLE READ
, andSERIALIZABLE
. The default isolation level forInnoDB
isREPEATABLE READ
.rem