# Best method to perform bulk updates

**URL:** <https://forums.percona.com/t/best-method-to-perform-bulk-updates/1102>\
**Category:** Other MySQL® Questions\
**Created:** [March 2, 2009, 6:51pm UTC](https://forums.percona.com/t/best-method-to-perform-bulk-updates/1102 "2009-03-02T18:51:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenny01](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@kenny01](https://forums.percona.com/u/kenny01)\
**Post date:** [March 2, 2009, 6:51pm UTC](https://forums.percona.com/t/best-method-to-perform-bulk-updates/1102/1 "2009-03-02T18:51:51Z")

</div>

Hi all,

I hope you can help me, I had an application, Is a messaging system and I would like to be able to do about 50000 updates every two seconds on a table indexed by autoincrement id.

What is the faster way to do these updates? Send these on the same query? disable the indexes?

Thanks in advance,  
Ken

---

<div class="post-metadata">

**Author:** ![aftabkhanahmed](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@aftabkhanahmed](https://forums.percona.com/u/aftabkhanahmed)\
**Post date:** [March 6, 2009, 4:56am UTC](https://forums.percona.com/t/best-method-to-perform-bulk-updates/1102/2 "2009-03-06T04:56:34Z")

</div>

Show us Create Table of that table. Have you tried batch update??, in case if your application need to set same values for many rows. i.e. UPDATE tb1 SET col=val WHERE id IN (…);

---

<div class="post-metadata">

**Author:** ![kenny01](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@kenny01](https://forums.percona.com/u/kenny01)\
**Post date:** [March 9, 2009, 7:33pm UTC](https://forums.percona.com/t/best-method-to-perform-bulk-updates/1102/3 "2009-03-09T19:33:37Z")

</div>

Hi

Thanks for your answer, below is the table, the engine is InnoDB.

I would like to update the status field from “PENDING” to “OK” on 50000 rows in one go, is that posible?

±------------±------------±-----±----±--------±------- --------+  
| Field | Type | Null | Key | Default | Extra |  
±------------±------------±-----±----±--------±------- --------+  
| id | bigint(20) | NO | PRI | NULL | auto\_increment |  
| reference | varchar(20) | YES | | NULL | |  
| status | varchar(10) | NO | | NULL | |  
±------------±------------±-----±----±--------±------- --------+

Thanks in advance.
