Use of delayed
Use delayed insert operations
The delayed modifier is applied to insert and replace statements. When the delayed insert operation arrives,
The server puts data rows in a queue and immediately returns a status message to the client.
You can continue the operation before the data table is actually inserted into the record. If the reader
When reading data from a table, the data in the queue will be kept until there is no reader. Then the server
Start to insert data rows in the delayed-row queue. During the insert operation, the server
Check whether new read requests arrive and wait. If yes, the delayed data row queue will be suspended,
Allow the reader to continue the operation. When no reader is available, the server inserts delayed data rows again.
This process continues until the queue is empty.
Notes:
· Insert delayed should be used only for the insert statement that specifies the Value List. The server ignores the delayed used for the insert delayed... select statement.
· The server ignores the delayed used for the insert delayed... on duplicate update statement.
· Because the statement is returned immediately before the row is inserted, you cannot use last_insert_id () to obtain the auto_increment value. The auto_increment value may be generated by the statement.
· For select statements, delayed rows are invisible until these rows are indeed inserted.
· Delayed is ignored in the slave replication server, because delayed does not generate data different from the master server in the slave server.
Note: Currently, each row in the queue is only stored in the memory until they are inserted into the table. This means that if you forcibly stop mysqld (for example, use kill-9)
Or if mysqld stops unexpectedly, all rows that are not written to the disk will be lost.