# conumdrum

**URL:** <https://forums.percona.com/t/conumdrum/881>\
**Category:** Other MySQL® Questions\
**Created:** [August 12, 2008, 4:22pm UTC](https://forums.percona.com/t/conumdrum/881 "2008-08-12T16:22:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mconnnors](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@mconnnors](https://forums.percona.com/u/mconnnors)\
**Post date:** [August 12, 2008, 4:22pm UTC](https://forums.percona.com/t/conumdrum/881/1 "2008-08-12T16:22:38Z")

</div>

Here is the statements, I am locked into using MYISAM because of server constraints and fulltext searching.

UPDATE categories SET left\_id = left\_id +2, right\_id = right\_id +2 WHERE left\_id \>168232  
UPDATE categories SET right\_id = right\_id +2 WHERE 168199 BETWEEN left\_id AND right\_id

These two queries take about 40 seconds each. I tried…

ALTER TABLE categories DISABLE KEYS  
UPDATE categories SET left\_id = left\_id +2, right\_id = right\_id +2 WHERE left\_id \>168232  
UPDATE categories SET right\_id = right\_id +2 WHERE 168199 BETWEEN left\_id AND right\_id  
ALTER TABLE categories ENABLE KEYS

but that didn’t save that much, I think it needs the keys to select. Is there a more efficient way to do this, it seems to me it should be an easy operation to do a math function on a column. Maybe not. Thanks to anyone who can help

---

<div class="post-metadata">

**Author:** ![mconnnors](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@mconnnors](https://forums.percona.com/u/mconnnors)\
**Post date:** [August 12, 2008, 6:34pm UTC](https://forums.percona.com/t/conumdrum/881/2 "2008-08-12T18:34:04Z")

</div>

–
