# Running query to update million records in the table - best way

**URL:** <https://forums.percona.com/t/running-query-to-update-million-records-in-the-table-best-way/407>\
**Category:** Other MySQL® Questions\
**Created:** [August 7, 2007, 12:49am UTC](https://forums.percona.com/t/running-query-to-update-million-records-in-the-table-best-way/407 "2007-08-07T00:49:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhaygupta](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@abhaygupta](https://forums.percona.com/u/abhaygupta)\
**Post date:** [August 7, 2007, 12:49am UTC](https://forums.percona.com/t/running-query-to-update-million-records-in-the-table-best-way/407/1 "2007-08-07T00:49:14Z")

</div>

Hi all,

I have a table with 6 fields. Index is implemented on 2 fields - ArticleId and CategoryId, which also form the composite primary key.

The table has more than a million records and we need to run updates on it every 10 minutes.

Please advice what is the best way to run an update query so it takes the least possible time.

Best regards,  
Abhay Gupta

---

<div class="post-metadata">

**Author:** ![Peter](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/peter/32/2_2.png) [@Peter](https://forums.percona.com/u/Peter)\
**Post date:** [August 16, 2007, 6:36am UTC](https://forums.percona.com/t/running-query-to-update-million-records-in-the-table-best-way/407/2 "2007-08-16T06:36:30Z")

</div>

Is it MyISAM or Innodb ?

I would first think if you really need to do it as it sounds nasty and would not scale well.

When you need to get table into memory and make sure update is well indexed and amount of extra indexes is kept to minimum.
