Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I migrate 3 million data to hierarchy table? #386

Closed
shawndodo opened this issue Sep 27, 2021 · 0 comments
Closed

How can I migrate 3 million data to hierarchy table? #386

shawndodo opened this issue Sep 27, 2021 · 0 comments

Comments

@shawndodo
Copy link
Contributor

shawndodo commented Sep 27, 2021

Hi all,
I want to add has_closure_tree to a model A having 3 million data, and I also want to create the initial data for model A's old data in hierarchy table. I think if I just use A.rebuild! with one sidekiq job, my db and system may be not able to withstand the impact. Then I tried to generate 500 records with each job to get the actual execution time. But I found that a job took an average of 6 minutes. Do you have any suggestions? Or whether I can only upgrade my db? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant