yichao firstname, zeaster nickname, zhang lastname

some options about insert in mysql

--complete-insert, -c
Use complete INSERT statements that include column names.

--delayed-insert
Write INSERT DELAYED statements rather than INSERT statements.
You can delay INSERT's from happening until the table is free by using the DELAYED hint in your SQL statement. For example:
INSERT DELAYED INTO table (col) VALUES ('val');
The above SQL statement will return quickly, and it stores the insert statement in a memory queue until the table your inserting into is free from reads. This means that if there are multiple inserts in the queue they can be written in one block, which is a more optimal use of IO.
The downside to this is that it is not transactionally safe at all. You don't really know how long its going to take for your INSERT to happen. If the server crashes, or is forcefully shutdown you will loose your INSERTs. So don't use this on any critical information that would suck to loose.
One great use for the DELAYED keyword would be for storing web stats in a database. You don't want the client waiting for the stats to insert, and its not that big of a deal if you loose a few stats (for most people).

--extended-insert, -e
Use multiple-row INSERT syntax that include several VALUES lists. This results in a smaller dump file and speeds up inserts when the file is reloaded.

No comments: