<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>roamschemer</author_name>
  <author_url>https://blog.hatena.ne.jp/roamschemer/</author_url>
  <blog_title>放浪軍師のアプリ開発局</blog_title>
  <blog_url>https://www.gunshi.info/</blog_url>
  <categories>
    <anon>Laravel</anon>
    <anon>PHP</anon>
    <anon>N+1問題</anon>
  </categories>
  <description>こんにちは。ブログをさぼりにさぼっている放浪軍師です。最近業務で N+1 問題解決のタスクが発生したのでまとめてみました。 N+1 問題とは？ まずそもそも N+1 問題とは何ぞやという話ですが、似たような SQL クエリを連発するような状態の事を指します。例えば、以下で簡単に発生させることが可能。 &lt;?php public function test_example(): void { //company 1:N user の関係 for ($i = 0; $i &lt; 5; $i++) { $company = Company::create(['name' =&gt; &quot;company_name_…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.gunshi.info%2Fentry%2F2024%2F03%2F28%2F012352&quot; title=&quot;Laravel でバックエンド 【N+1問題編】 - 放浪軍師のアプリ開発局&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.user.blog.st-hatena.com/default_entry_og_image/149946361/1556516566609930</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2024-03-28 01:23:52</published>
  <title>Laravel でバックエンド 【N+1問題編】</title>
  <type>rich</type>
  <url>https://www.gunshi.info/entry/2024/03/28/012352</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
