doushan1863
2011-07-21 05:00
浏览 66
已采纳

MySQL InnoDB - 避免为单个事务刷新日志缓冲区?

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 you 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?

图片转代码服务由CSDN问答提供 功能建议

是否有可能以编程方式告诉MySQL不要立即为当前事务刷新日志缓冲区,而不管< 代码> innodb_flush_log_at_trx_commit 设置?

假设您通常需要ACID合规性,以便您的数据免受任何电源/硬件故障的影响。 所以你有 innodb_flush_log_at_trx_commit = 1

但是在你的应用程序中,你有一个特殊的INSERT查询需要快速返回,并且它没有那么重要 同等级的完整性保护。 您是否可以跳过该查询/事务的刷新(在其事务结束时)? 你可以用PHP查询或PHP的PDO中的某些东西以编程方式进行吗?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doudu5029 2011-07-25 05:06
    已采纳

    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.

    打赏 评论
  • doukou4066 2011-07-21 05:02

    I'm not sure if this will do exactly what you want, but check out INSERT DELAYED.

    打赏 评论

相关推荐 更多相似问题