<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ytkr0813</author_name>
  <author_url>https://blog.hatena.ne.jp/ytkr0813/</author_url>
  <blog_title>LCL Engineers' Blog</blog_title>
  <blog_url>https://techblog.lclco.com/</blog_url>
  <categories>
    <anon>Rails</anon>
  </categories>
  <description>バックエンドエンジニアの横塚です。 Railsで中規模以上のサービスを運用していると、大量のレコードやcsvをバッチで処理したい場面などが出てくると思います。 当たり前のように意識できている人も多いかと思いますが、今回はおさらいの意味も込めてバッチで大量データを扱うときに気をつけていることをまとめていこうと思います！ 大量レコードに対して処理をするときはfind_eachやfind_in_batchesを使う DBからデータを取得してきて処理をしたい場合、eachで処理しようとすると対象データがすべてメモリに展開されてしまいますが、find_eachは1行ずつメモリに展開するため、レコード数を…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftechblog.lclco.com%2Fentry%2F2019%2F07%2F31%2F180000&quot; title=&quot;Railsで大量データを扱うときに気をつけていること - LCL Engineers&amp;#39; Blog&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/y/ytkr0813/20190731/20190731101326.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-07-31 18:00:00</published>
  <title>Railsで大量データを扱うときに気をつけていること</title>
  <type>rich</type>
  <url>https://techblog.lclco.com/entry/2019/07/31/180000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
