<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>madogiwa0124</author_name>
  <author_url>https://blog.hatena.ne.jp/madogiwa0124/</author_url>
  <blog_title>Madogiwa Blog</blog_title>
  <blog_url>https://madogiwa0124.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
    <anon>Ruby on Rails</anon>
    <anon>開発</anon>
  </categories>
  <description>ActiveRecord::Relation#explainを使うと、実行するSQLのEXPLAINの結果を取得出来ます。ActiveRecord::Relation#explainではデフォルト設定でしか結果を取得出来なのですが、EXPLAINにはオプションが設定できます。 特にMySQLではオプティマイザが評価したSQLのコスト等の詳細な情報はJSON形式のEXPLAINでしか取得できません😢 dev.mysql.com 実際の結果の違いを見るとJSON形式のほうが有用な情報が多いことが分かると思います👀 EXPLAIN SELECT `samples`.* FROM `samples` …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmadogiwa0124.hatenablog.com%2Fentry%2F2020%2F03%2F29%2F151836&quot; title=&quot;ActiveRecordにモンキーパッチを当ててJSON形式のEXPLAINを取得出来るようにする🐵 - Madogiwa 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></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2020-03-29 15:18:36</published>
  <title>ActiveRecordにモンキーパッチを当ててJSON形式のEXPLAINを取得出来るようにする🐵</title>
  <type>rich</type>
  <url>https://madogiwa0124.hatenablog.com/entry/2020/03/29/151836</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
