MySQL delayed insertion

Source: Internet
Author: User

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.