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