开发者

Populating the db with 1M rows

开发者 https://www.devze.com 2023-03-13 04:11 出处:网络
Reading on Rails and indexing associations. The author mentions writing 1M rows of dummmy data into the db for testing performance? How did he d开发者_StackOverflow中文版o this? Through an each loop i

Reading on Rails and indexing associations. The author mentions writing 1M rows of dummmy data into the db for testing performance? How did he d开发者_StackOverflow中文版o this? Through an each loop in the seed.rb file? or is there a better way?


Gems like machinist do a good job of generating model instances for you. Particularly in conjunction with ffaker to give you all sorts of 'believable' test data.

You might also want to take a look at activerecord-import for mass-importing data. It will do bulk inserts when your database supports it (e.g. everything except for sqlite) and greatly speed them up.


He probably loaded data from a file. I like to use ruby to generate test data. (I don't do Rails development, but I have to do a lot of database testing.)

0

精彩评论

暂无评论...
验证码 换一张
取 消