Is it possible to programmatically tell MySQL not to flush the log buffer immediately just for the current transaction, regardless of the innodb_flush_log_at_trx_commit
setting?
Let's say you generally want ACID compliance so that your data is safe from any power/hardware faults. So y开发者_JS百科ou have innodb_flush_log_at_trx_commit = 1
But in your application, you have one particular INSERT query that needs to return quickly, and it's not as important for it to have the same level of integrity protection. Can you skip the flush (at the end of its transaction) just for that query/transaction? And can you do it programmatically, with an SQL query or something in PHP's PDO?
I think the answer is that it can't be done - unless you are willing to switch to MyISAM just for the particular table in question.
I'm not sure if this will do exactly what you want, but check out INSERT DELAYED
.
精彩评论