MySQL?е?????????????????????????
???????????? ???????[ 2016/5/31 10:58:09 ] ????????????? MySQL
??????????????????к?????????????????????????????????????????????????????????????????????????????????StockPrice??????????????????
????????1
START TRANSACTION; update StockPrice SET close = 45.50 WHERE stock_id = 4 and date = '2002-05-01'; UPDATE StockPrice SET close = 19.80 WHERE stock_id = 3 and date = '2002-05-02'; COMMIT;
???????? #2
START TRANSACTION; UPDATE StockPrice SET high = 20.12 WHERE stock_id = 3 and date = '2002-05-02'; UPDATE StockPrice SET; COMMIT;
?????????????????????????????????????????????????????????????????????????е????????????????????????????????????????????????????????????????????
??????????????????????????????????????????????InnoDB?????????洢???????????????????????????????????????????2????????????????Щ??????????????????????????InnoDB???????????????????????????м???????????????????????ο????
??????????????????洢???????????????Щ?洢??????????????????????·????????????????????С?????????????Щ????????????????????????Щ??????洢?????????????????
??????в???????????????е??????????????????????????????????п???????????????????????????????????????????Щ???????????????????
??????δ???????
???????????????????????????????????????????????????????????????????????????????????Σ?????????????????д?????ó????????????????????????????? ?????????????·??????????
????InnoDB???????м??????????????????????????е??????????£?????????????????????????Щ??????????????“??С??”?????????????????????е???????????????????????????????
??????????????м?????????????????????????????
??????Use SHOW INNODB STATUS?????????????????????????????????????ó???????????????
????????????????·?????????????????????????????????Σ?????????Ρ?
?????????????????С??????????????????
????????????????????????SELECT ... FOR UPDATE?? ... LOCK IN SHARE MODE???????????????????????READ COMMITTED??
??????????????????????С????????γ????????????????????????
??????????????????????????????????????????????????????????????????????????EXPLAIN SELECT????????????????mysql??????????????????
???????????????????????????????????SELECT?????????????????????????????FOR UPDATE??LOCK IN SHARE MODE??????????READ COMMITTED????????????????????????????????????????????????????????
?????????б???а??????????????????л??????????LOCK TABLES????????????InnoDB)???????????????AUTOCOMMIT = 0 ?????????UNLOCK TABLES?????????????????????磬????????д??t1?????t??????????????????
SET AUTOCOMMIT=0; LOCK TABLES t1 WRITE?? t2 READ?? ...; [do something with tables t1 and t2 here]; COMMIT; UNLOCK TABLES;
?????????????????????????????????????????????
???????????л???????????????????????“semaphore” ????????????????С???????????????????????????????С????????????????????????е????????????InnoDB??????????????????????????????????????л????????м??????????????????MySQL??????????????????????????
????????ó????????LOCK TABLES???????AUTOCOMMIT=1??MySQL???趨InnoDB????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11