Not so long time ago I had task to update string column in table with 10mil+ rows, and, as the manipulation was non-trivial, I decided this task is good to try Stored Function. Function written - go ahead. Since 5 min I got totally frozen box with no free memory and giant swap.
The case was worth to look deeply - let's try simple table (experiments with MySQL 5.0.45)
PLAIN TEXT SQL:
- CREATE TABLE `testf` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM AUTO_INCREMENT=20971521 DEFAULT CHARSET=latin1
- mysql> SELECT count(*) FROM testf;
- +----------+
- | count(*) |
- +----------+
- | 20971520 |
- +----------+
- 1 row IN SET (0.00 sec)
and simple …
[Read more]