Hỗ trợ cho các phím nước ngoài và cam kết, rollback, và cuộn về phía trước hoạt động hoàn thành bức tranh này là một trong hầu hết các định dạng bảng đầy đủ tính năng có sẵn trong MySQL. Không đồng bộ I / O và một bộ đệm đọc trước tuần tự cải thiện tốc độ phục hồi dữ liệu, và một "thuật toán bạn thân" và kết quả loại Oracle tablespaces trong tập tin tối ưu hóa và quản lý bộ nhớ. . | 128 Part I Usage Locking more than one table at the same time is not uncommon. This can be easily accomplished by specifying a comma-separated list of table names and lock types after the LOCK TABLES command as in the following mysql LOCK TABLES flight READ flightdep WRITE Query OK 0 rows affected sec The previous statement locks the flight table in read mode and the flightdep table in write mode. Tables can be unlocked with a single UNLOCK TABLES command as in the following mysql UNLOCK TABLES Query OK 0 rows affected sec There is no need to name the tables to be unlocked. MySQL automatically unlocks all tables that were locked previously via LOCK TABLES. There are two main types of table locks read locks and write locks. Let s take a closer look. The READ Lock A READ lock on a table implies that the thread client setting the lock can read data from that table as can other threads. However no thread can modify the locked table by adding updating or removing records for so long as the lock is active. Here s a simple example you can try to see how READ locks work. Begin by placing a READ lock on the flight table mysql LOCK TABLE flight READ Query OK 0 rows affected sec Then read from it mysql SELECT FlightID FROM flight LIMIT 0 4 --------- flightid --------- 345 535 589 652 --------- 4 rows in set sec No problems there. Now write to it mysql INSERT INTO flight FlightID RouteID AircraftID - VALUES 834 1061 3469 ERROR 1099 HY000 Table flight was locked with a READ lock and can t be updated Chapter 5 Using Transactions 129 MySQL rejects the INSERT because the table is locked in read-only mode. What about other threads clients accessing the same table For these threads reads selects will work without a problem. However writes inserts updates or deletes will cause the initiating thread to halt and wait for the lock to be released before proceeding. Thus only after the locking thread executes an UNLOCK TABLES command and releases its locks will the .