CRUD! The Consequences of Not Understanding How ActiveRecord ...
summary
Shows concrete failures and fixes: naive ActiveRecord INSERT-per-row makes 10,000 inserts take 45.9s → <3s by switching to batched raw INSERTs, with a tested batch size ~2000 to avoid max_packet issues; use find_each and pluck to avoid memory bloat (pluck on 100k records hits 2.11s vs each/find_each ≈9–11s); prefer update_all/delete directly or raw SQL instead of instantiating objects; mentions Arel, MySQL, NewRelic, MiniProfiler and Bullet as profiling tools and warns of timeouts, memory and stack errors.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 1:20The pitfalls of Active Record
- 2:55Application model overview
- 4:48Optimizing data creation
- 8:21Efficient data retrieval
- 10:47Updating records in bulk
- 12:10Bulk deletion techniques
- 18:04Conclusion and tools
related talks
34mOh S***: How to bring a big Rails website down (and how not to)
33mThe Very Hungry Transaction
14mDatabase Performance at Scale for RoR Applications
42mActiveRecord is Still Magical
37mCache is King: Get the Most Bang for Your Buck From Ruby
34mThe Very Hungry Transaction
29mTidying Active Record Allocations
26mBiggish Data With Rails and Postgresql
