最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

wp query - update_post_meta performance in a loop woocommerce

programmeradmin0浏览0评论

I have a simple question, I am working on the list order screen of woocommerce and want to add some buttons that via ajax will update some data to the database using update_post_meta. The issue is that these buttons are pressed with a frequency more or less 10 times/minute.

Can this generate any problem with the database?

If the answer is yes, what would be the best practice for this?

I thought that maybe I can update this data at the same time, however, if I put this in a loop:

loop of 40 items{
    update_post_meta
}

I think it will be worse, won't it?

I have a simple question, I am working on the list order screen of woocommerce and want to add some buttons that via ajax will update some data to the database using update_post_meta. The issue is that these buttons are pressed with a frequency more or less 10 times/minute.

Can this generate any problem with the database?

If the answer is yes, what would be the best practice for this?

I thought that maybe I can update this data at the same time, however, if I put this in a loop:

loop of 40 items{
    update_post_meta
}

I think it will be worse, won't it?

Share Improve this question asked Feb 8, 2019 at 16:29 federico sgoifofederico sgoifo 313 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I think, an idea would be to save your values on a new small table with all you need, and have a script that once every "n" hours update all metas.

发布评论

评论列表(0)

  1. 暂无评论