douqian4411 2012-06-16 17:49
浏览 47

MySQL“Fire-And-Forget”INSERT / UPDATE / DELETE - mysql_unbuffered_query用法是否可行?

We have quite a few queries we consider "fire and forget".

In the sense that these are just logging inserts, updates and such. Things that are not as critical, and data from which is never used on the front end the users sees.

This sounds like an ideal case for mysql_unbuffered_query.

Is this advisable?

We are using innodb so using something like INSERT DELAYED is not possible.

Thanks!

  • 写回答

1条回答 默认 最新

  • douxian4376 2012-07-01 21:46
    关注

    After reading http://www.php.net/manual/en/mysqlinfo.concepts.buffering.php:

    Following these characteristics buffered queries should be used in cases where you expect only a limited result set or need to know the amount of returned rows before reading all rows. Unbuffered mode should be used when you expect larger results.

    Seem that unbuffered query are usefull only on select, because update, insert and delete have no result set.

    I don't see any problem using unbuffered update, insert and delete except this:

    Unless the full result set was fetched from the server no further queries can be sent over the same connection. Unbuffered queries can also be referred to as "use result".

    So, are last_insert_id and affected_rows a result? I don't belive it, because no mysql_fetch* is done to get these infos.

    So, if you experience an improve of performances using unbuffered query, use it!

    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法