What to do when you run out of database IDs

If your project processes 232 jobs you'll run out of IDs in the result table. If this happens you can compress the ID space using the following queries:

alter table result add column tmpid int;

set @count = 0;
update result set tmpid = @count:= @count + 1;

update workunit inner join result on = workunit.canonical_resultid set workunit.canonical_resultid = result.tmpid;

update result set id = tmpid;

alter table result auto_increment = 1;
Last modified 3 years ago Last modified on 08/12/14 09:46:32