MySQL?????÷???????
???????????? ???????[ 2012/9/3 13:19:54 ] ????????
??????????????????б?????????????????????????????????????????????Ч??????MySQL??????????????????????м????????????MySQL????????????????????????????????????????MySQL??????????????MYISAM??INNODB?????????????
????????????????????????д???????????????????????ж??????????????????????????д????????????????2??????????????????????????????????
??????????
?????÷???LOCK TABLE table_name [ AS alias_name ] READ
?????????????LOCK?????READ?????AS??????????????????????????????????????????
?????????????????????????????????д???????????????????
????????????????????????????????????????????????????????????д??
д???? ??????
????????? ??????? ??
??????????? ???????? ??
????????????????MySQL??????????????????κ??????????????????????????????????????????????ж???????д?????????????????????????????????????MySQL??????????????ж????????????????У????????д???????????????????????????????????ж???????????????????д??????
????д????
?????÷???LOCK TABLE table_name [AS alias_name] [ LOW_PRIORITY ] WRITE
?????????÷???????????д??????????????????????????LOW_PRIORITY???????д????????????
????????д???????????????????????д????????????????????????
?????????????????MySQL????????????????д????????
д???? ??????
???д????? ?? ??
?????д????? ???????? ?????????
???????????д????MySQL??????????????????ж?д?????????????????????????????д??????????????????????д??????
?????????????????
????????????????????????? LOW_PRIORITY WRITE < READ < WRITE
????1????????????????????????????WRITE??????????WRITE??????????READ????LOW_PRIORITY WRITE??????WRITE????READ?????????л???????????
????2???????????????????????????????????????????
???????????
????1??????????????????£???б?????????
???????統(tǒng)?????table1???????SQL????а?????table2???????????????磺
mysql> LOCK TABLE test READ;
Query OK?? 0 rows affected (0.00 sec)
mysql> SELECT * FROM test_myisam;
ERROR 1100 (HY000): Table 'test_myisam' was not locked with LOCK TABLES
????2???????????SQL????????α??????????????
??????SQL????ж??????????????????????磺
mysql> LOCK TABLE test READ;
Query OK?? 0 rows affected (0.00 sec)
mysql> SELECT * FROM test WHERE id IN (SELECT id FROM test );
ERROR 1100 (HY000): Table 'test' was not locked with LOCK TABLES
????????????????????????????????????????????????????????????
mysql> LOCK TABLE test AS t1 READ?? test AS t2 READ;
Query OK?? 0 rows affected (0.00 sec)
mysql> SELECT * FROM test AS t1 WHERE id IN (SELECT id FROM test AS t2);
+----+-----------+
| id | content |
+----+-----------+
| 1 | tt_1 |
| 3 | new_3 |
| 4 | new_4 |
| 5 | content_5 |
+----+-----------+
4 rows in set (0.00 sec)
????3???????????????????????????????????????
??????
???·???
??????????????????
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