DEV Community

Cover image for Performance Guide to create 100k records in less than 3s using Ruby on Rails

Performance Guide to create 100k records in less than 3s using Ruby on Rails

Pimp My Ruby on October 25, 2023

When working on large-scale projects, quickly creating test data or dummy data can be crucial. In this article, we will explore different methods t...
Collapse
 
btrewern profile image
Ben

If you really want fast imports into PostgreSQL then copy is your friend. There is a gem called activerecord-copy that should be useful. It again does not go through validations or callbacks but could be up to 3-4 times as fast as .insert_all / .upsert_all.

Collapse
 
pimp_my_ruby profile image
Pimp My Ruby

Hi Ben! Thanks for your feedback.

You're completely right, I already used this alternative, but I wanted to do a separate article for this one as the performance are very above the other alternatives.

Collapse
 
maprangsoft profile image
Maprangsoft

thank you.

Collapse
 
harry_wood profile image
Harry Wood

Interpretation point 6 is missing some words

Collapse
 
pimp_my_ruby profile image
Pimp My Ruby

Hey!

Thanks, I have updated the article with the missing content!