Reputation: 10762
I plan to index my 100 million row (ruby on rails) database on a couple of fields, and the problem is that I have no way of knowing the progress of these migrations.
Usually, if I am running a manual data migration, I will do a basic i+=1;print("#{i},")
to keep track of how far along it is, and to make sure it is still working.
Does anyone know if there is a way to do something like this with my indexing migration so i can monitor its progress?
Upvotes: 0
Views: 61
Reputation: 121
You could fork and create the index in one process while outputting the progress information in the other. It would look something like this:
pid = fork {
# do index creation here
}
child_pid = nil
begin
child_pid = Process.waitpid(pid, Process::WNOHANG)
# output progress info here
end while child_pid.nil?
Upvotes: 1