目次 検証環境前提条件オリジナルコード ベンチマーク最適化1: 簡単な最適化 ベンチマーク最適化2: where & each を使う ベンチマーク最適化3: find_each を使う ベンチマーク最適化4: in_batches & update_all を使う ベンチマーク最適化5: where & update_all ベンチマーク最終結果「ActiveRecordデータ処理アンチパターン」で発表します参考リンクRailsのバッチ処理最適化の記事書いたら需要あるかな — toshimaru (@toshimaru_e) December 2, 2017ということで今日はRailsバッチ処理の最適化について書いてみたいと思います。 検証環境コードの検証に使った環境は下記の通りです。 macOS High Sierra (2.3 GHz Intel Core i5 / メモリ8G)Ru
![Rails/ActiveRecord バッチ処理の最適化 - Hack Your Design!](https://cdn-ak-scissors.b.st-hatena.com/image/square/d19402c1cacff7871f8c27c872cbb60056d52cfa/height=288;version=1;width=512/https%3A%2F%2Fblog.toshimaru.net%2Fimages%2Fposts%2Frailsdm%2Far-optimization.png)