我发现我的 Model.create!
语句服用很长一段时间,当我加入了大量的记录一次运行。看着 ActiveRecord的导入但它并没有使用哈希数组的工作(这是我已经和这我认为这是常见的pretty的)。如何提高性能?
I found that my Model.create!
statements were taking a very long time to run when I added a large number of records at once. Looked at ActiveRecord-Import but it didn't work with an array of hashes (which is what I have and which I think is pretty common). How can I improve the performance?
我开始运行到出现问题大量记录(> 10000),所以我修改了code在1000组记录在工作时间。这里是一个链接到新的code:
I started running into problems with large numbers of records (> 10000), so I modified the code to work in groups of 1000 records at a time. Here is a link to the new code:
https://gist.github.com/jackrg/76ade1724bd816292e4e
上一篇:错误:未找到属性“adSize”在包资源标识符“com.google.example”main.xml中标识符、未找到、属性、错误
下一篇:我如何获得通过的ActiveRecord的Ruby on Rails的最后执行的SQL查询?如何获得、ActiveRecord、Ruby、SQL