If your insert statements are not time critical, you can use insert delayed in your SQL to speed things up. The syntax is as follows.
INSERT DELAYED table (col1, col2) VALUES ('a', 'b');
Insert delayed can be used with MyISAM and Memory, but cannot be used with InnoDB.
The advantage of using insert delayed is that the MySQL server returns a success message straight away so the script can keep going, without it actually having to do the insert. This allows the MySQL server to carry it out when it isn’t busy, and do several at the same time.
It’s appropriate for tables such as logs tables where it doesn’t matter too much if they don’t go in straight away.
Don't have time to check my blog? Get a weekly email with all the new posts. This is my personal blog, so obviously it is 100% spam free.
Tags: insert, insert delayed, mysql, performance, sql
This entry was posted on Thursday, January 12th, 2012 at 11:00 am and is filed under Life, Tech. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.