- 07 Jan 2010 -
We have well over 50 million rows in our obs table. Using the simple “update obs set uuid = uuid() where uuid is null” would bomb out with a “The total number of locks exceeds the lock table size” error.
I ran this for a few hours to get through all rows. (Note that it overwrites any uuids that are currently there)
Copy this into a sql script and run it with “source” in mysql at command line.
drop procedure update_uuids;
delimiter //
create procedure update_uuids() begin
set @max = (select max(obs_id) from obs);
set @x = 1;
repeat
set @y = @x + 100000;
update obs set uuid = uuid() where obs_id >=@x and obs_id <@y;
set @x = @y;
until @x > @max
end repeat;
end
//
delimiter ;
call update_uuids();
February 5th, 2010 at 12:35 pm
Sorry if this is obvious, but what are the uuids actually used for in OpenMRS, since there are always other unique keys and foreign keys on all the pertinent tables? Pointing me to the right place in the documentation for this is of course preferable. Thanks!
February 5th, 2010 at 12:40 pm
Uuids are document on the openmrs wiki here: http://openmrs.org/wiki/UUIDs . The short answer to your question is for synchronization across sites within one installation group