mysql:9953
From: ML account <ML account <ml@xxxxxxxxxx>>
Date: Fri, 06 Aug 2004 05:37:24 +0900
Subject: [mysql 09953] Re: データのロックについて
こんにちは。 "TAKAHASHI, Tomohiro" <t_takahashi@xxxxxxxxxx>さんの <411241D4.E146DF19@xxxxxxxxxx> "[mysql 09952] Re: データのロックについて" > 下記の「端末2で見る」ですが、「端末1」と(特に)「端末2」は > それぞれどのような順序でどのようなSQL文を発行したのでしょうか? こんな感じです。行の上から下へが時間の経過を示しています。 term1=端末1、term2=端末2、です。分離レベルはデフォルトのREPEATABLE-READ です。テーブルBBBは、"create table BBB (ID int) type=InnoDB"で作ってあり ます。プラットフォームはWindows2000Server(SP4)、PenIII-1GHz*2、Mem768MB です。 term1 | term2 ---------------------------------+-------------------- set autocommit=0; | | set autocommit=0; select * from BBB; | | select * from BBB; update BBB set ID=2 where ID=1; | | select * from BBB; commit; | | select * from BBB; select * from BBB; | ・端末1のログ Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 4.0.15-max Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select * from BBB; +------+ | ID | +------+ | 1 | +------+ 1 row in set (0.11 sec) mysql> set autocommit=0; Query OK, 0 rows affected (0.00 sec) mysql> update BBB set ID=2 where ID=1; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> commit; Query OK, 0 rows affected (0.03 sec) mysql> select * from BBB; +------+ | ID | +------+ | 2 | +------+ 1 row in set (0.00 sec) mysql> ・端末2のログ Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 to server version: 4.0.15-max Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> set autocommit=0; Query OK, 0 rows affected (0.00 sec) mysql> select * from BBB; +------+ | ID | +------+ | 1 | <------- これは当たり前 +------+ 1 row in set (0.00 sec) mysql> select * from BBB; +------+ | ID | +------+ | 1 | <------- これも当たり前 +------+ 1 row in set (0.00 sec) mysql> select * from BBB; +------+ | ID | +------+ | 1 | <------- これが気に入らない +------+ 1 row in set (0.00 sec) mysql> 端末2では挿入/更新/削除系のクエリは発行していないですが、敢えて commitを発行した後はID=2となる様な気がします。何でしょうねえ?こういうも のなのでしょうか?とすれば、強い違和感があります。 mysql> select * from BBB; +------+ | ID | +------+ | 1 | <------- これが気に入らない +------+ 1 row in set (0.00 sec) mysql> commit; Query OK, 0 rows affected (0.00 sec) mysql> select * from BBB; +------+ | ID | +------+ | 2 | <------- これで気に入る様になった +------+ 1 row in set (0.00 sec) mysql> 松枝知直 <tomom@xxxxxxxxxx> http://www.argus.ne.jp/~tomom/
9940 2004-08-04 13:17 ["Mamiya Masataka" <x] データのロックについて 9943 2004-08-05 10:06 ┣["Mamiya Masataka" <x] 9944 2004-08-05 10:36 ┗[ML account <ml@xxxxx] 9945 2004-08-05 11:26 ┣[seiji takegata <take] 9946 2004-08-05 13:30 ┃┣[ML account <ml@xxxxx] 9949 2004-08-05 15:24 ┃┃┗[EBIHARA Yuichiro <ui] 9951 2004-08-05 23:09 ┃┃ ┗[ML account <ml@xxxxx] 9952 2004-08-05 23:19 ┃┃ ┣["TAKAHASHI, Tomohiro] -> 9953 2004-08-06 05:37 ┃┃ ┃┗[ML account <ml@xxxxx] 9954 2004-08-06 05:51 ┃┃ ┃ ┗[ML account <ml@xxxxx] 9955 2004-08-06 11:25 ┃┃ ┃ ┗["HIROSE, Masaaki" <h] 9957 2004-08-06 13:30 ┃┃ ┃ ┗[ML account <ml@xxxxx] 9958 2004-08-06 14:04 ┃┃ ┃ ┣[SUGAWARA Hajime <sug] 9959 2004-08-06 14:17 ┃┃ ┃ ┣[とみたまさひろ <tomm] 9960 2004-08-06 16:50 ┃┃ ┃ ┗["HIROSE, Masaaki" <h] 9962 2004-08-07 16:49 ┃┃ ┃ ┗[ML account <ml@xxxxx] 9969 2004-08-09 18:24 ┃┃ ┃ ┣[<kuyo@xxxxxxxxxx> ] 9970 2004-08-10 00:20 ┃┃ ┃ ┃┗["akira" <akrst@xxxxx] 9975 2004-08-10 09:30 ┃┃ ┃ ┃ ┗[ML account <ml@xxxxx] 9976 2004-08-10 10:48 ┃┃ ┃ ┃ ┣["TAKAHASHI, Tomohiro] 9997 2004-08-11 13:03 ┃┃ ┃ ┃ ┗[<akrst@xxxxxxxxxx> ] 9983 2004-08-10 18:28 ┃┃ ┃ ┣[とみたまさひろ <tomm] 9987 2004-08-10 20:28 ┃┃ ┃ ┃┗[ML account <ml@xxxxx] 9988 2004-08-10 21:26 ┃┃ ┃ ┃ ┣[<kuyo@xxxxxxxxxx> ] 9994 2004-08-11 11:38 ┃┃ ┃ ┃ ┃┗[ML account <ml@xxxxx] 10004 2004-08-12 01:03 ┃┃ ┃ ┃ ┃ ┗[Tomoyuki Ishino <ish] 10006 2004-08-12 08:54 ┃┃ ┃ ┃ ┃ ┗[ML account <ml@xxxxx] 10012 2004-08-13 12:52 ┃┃ ┃ ┃ ┃ ┗[Tomoyuki Ishino <ish] 10014 2004-08-13 20:08 ┃┃ ┃ ┃ ┃ ┗[ML account <ml@xxxxx] 9989 2004-08-10 23:39 ┃┃ ┃ ┃ ┗[とみたまさひろ <tomm] 9992 2004-08-11 10:54 ┃┃ ┃ ┃ ┣["Tomo Ikehara" <tomo] 9995 2004-08-11 12:08 ┃┃ ┃ ┃ ┃┣["TAKAHASHI, Tomohiro] 10001 2004-08-11 16:16 ┃┃ ┃ ┃ ┃┃┣["TAKAHASHI, Tomohiro] Re: データのロックについて(余談:START TRANSACTION) 10003 2004-08-12 00:51 ┃┃ ┃ ┃ ┃┃┃┗[とみたまさひろ <tomm] 10011 2004-08-13 11:06 ┃┃ ┃ ┃ ┃┃┗["Tomo Ikehara" <tomo] 9999 2004-08-11 15:40 ┃┃ ┃ ┃ ┃┗[EBIHARA Yuichiro <ui] 10017 2004-08-13 22:42 ┃┃ ┃ ┃ ┃ ┗["Tomo Ikehara" <tomo] 9993 2004-08-11 11:38 ┃┃ ┃ ┃ ┗[ML account <ml@xxxxx] 10000 2004-08-11 15:53 ┃┃ ┃ ┃ ┣[EBIHARA Yuichiro <ui] 10008 2004-08-12 10:30 ┃┃ ┃ ┃ ┃┗[ML account <ml@xxxxx] 10009 2004-08-12 11:57 ┃┃ ┃ ┃ ┃ ┗[<kuyo@xxxxxxxxxx> ] 10013 2004-08-13 20:07 ┃┃ ┃ ┃ ┃ ┗[ML account <ml@xxxxx] 10016 2004-08-13 22:02 ┃┃ ┃ ┃ ┃ ┣[とみたまさひろ <tomm] 10018 2004-08-14 19:58 ┃┃ ┃ ┃ ┃ ┗[<kuyo@xxxxxxxxxx> ] 10005 2004-08-12 01:32 ┃┃ ┃ ┃ ┗[とみたまさひろ <tomm] 10010 2004-08-13 01:25 ┃┃ ┃ ┗["HIROSE, Masaaki" <h] 9956 2004-08-06 11:44 ┃┃ ┗[EBIHARA Yuichiro <ui] 9974 2004-08-10 09:30 ┃┃ ┗[ML account <ml@xxxxx] 9982 2004-08-10 16:41 ┃┃ ┗[EBIHARA Yuichiro <ui] 9986 2004-08-10 20:25 ┃┃ ┗[ML account <ml@xxxxx] 9950 2004-08-05 16:20 ┃┗[HAMAI Kyoichi <k-ham] 9947 2004-08-05 13:35 ┗["Mamiya Masataka" <x] 9948 2004-08-05 15:03 ┗[ML account <ml@xxxxx]