<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>yanterakun</author_name>
  <author_url>https://blog.hatena.ne.jp/yanterakun/</author_url>
  <blog_title>下級エンジニアの綴</blog_title>
  <blog_url>https://yanterakun.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>railsでまとめてデータを削除したいときにdestroy_allを使用していたのですが、実際に動いているsql文を見て想定と違ったので調べたのでメモ。 内容としては 数十万件のレコードを舐める時に1000件単位で削除を行おうと思ってコードを書いており、1000件のオブジェクトごとにdestroy_allをかけていました。 想定していた挙動は 1000件まとめてレコードを削除するdelete文が叩かれる事 でしたが、 実際は1レコードずつ削除するdelete文 が叩かれていました。 気になったのでrailsのapidockを見たところdestroy_allの実際の処理は配列のオブジェクトをea…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fyanterakun.hatenablog.com%2Fentry%2F2017%2F11%2F29%2F060000&quot; title=&quot;destroy_allの挙動が思ったのと違ったのでメモ。 - 下級エンジニアの綴&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></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2017-11-29 06:00:00</published>
  <title>destroy_allの挙動が思ったのと違ったのでメモ。</title>
  <type>rich</type>
  <url>https://yanterakun.hatenablog.com/entry/2017/11/29/060000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
