SELECT 
  company_descriptions.*, 
  companies.*, 
  vendor_plan_descriptions.plan, 
  seo_names.name as seo_name, 
  seo_names.path as seo_path, 
  vendor_ga_tracking_code, 
  vendor_fb_tracking_code, 
  AVG(discussion_rating.rating_value) AS average_rating, 
  CONCAT(
    companies.company_id, 
    '_', 
    IF (
      discussion_rating.thread_id, discussion_rating.thread_id, 
      '0'
    )
  ) AS company_thread_ids 
FROM 
  companies AS companies 
  LEFT JOIN company_descriptions AS company_descriptions ON company_descriptions.company_id = companies.company_id 
  AND company_descriptions.lang_code = 'en' 
  LEFT JOIN vendor_plan_descriptions ON companies.plan_id = vendor_plan_descriptions.plan_id 
  AND vendor_plan_descriptions.lang_code = 'en' 
  LEFT JOIN seo_names ON seo_names.object_id = 2604 
  AND seo_names.type = 'm' 
  AND seo_names.dispatch = '' 
  AND seo_names.lang_code = 'en' 
  LEFT JOIN discussion as discussionA ON discussionA.object_id = companies.company_id 
  AND discussionA.object_type = 'M' 
  LEFT JOIN discussion_posts ON discussion_posts.thread_id = discussionA.thread_id 
  AND discussion_posts.status = 'A' 
  LEFT JOIN discussion_rating ON discussionA.thread_id = discussion_rating.thread_id 
  AND discussion_rating.post_id = discussion_posts.post_id 
WHERE 
  companies.company_id = 2604

Query time 0.00111

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.82"
    },
    "nested_loop": [
      {
        "table": {
          "table_name": "companies",
          "access_type": "const",
          "possible_keys": [
            "PRIMARY"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "company_id"
          ],
          "key_length": "4",
          "ref": [
            "const"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.00",
            "eval_cost": "0.10",
            "prefix_cost": "0.00",
            "data_read_per_join": "14K"
          },
          "used_columns": [
            "company_id",
            "status",
            "company",
            "lang_code",
            "address",
            "city",
            "state",
            "country",
            "zipcode",
            "email",
            "phone",
            "url",
            "storefront",
            "secure_storefront",
            "entry_page",
            "redirect_customer",
            "countries_list",
            "timestamp",
            "shippings",
            "logos",
            "request_user_id",
            "request_account_name",
            "request_account_data",
            "plan_id",
            "stripe_connect_account_id",
            "identifier_facebook_pixel",
            "featured_products",
            "sd_ga_tracking_code",
            "paypal_commerce_platform_account_id",
            "tagline",
            "url_facebook",
            "url_instagram",
            "url_twitter",
            "url_pinterest",
            "announcement",
            "shippo_api_token",
            "shippo_carrier",
            "shippo_service_type",
            "vendor_ga_tracking_code",
            "vendor_fb_tracking_code",
            "custom_domain",
            "custom_domain_status",
            "taxjar_key",
            "taxjar_export_statuses",
            "taxjar_export_csv_data",
            "ag_hide_city",
            "updated_timestamp",
            "suspend_date",
            "grace_period_start",
            "last_time_suspended",
            "last_debt_notification_time",
            "tax_number",
            "stripe_connect_account_type",
            "registered_from_storefront_id"
          ]
        }
      },
      {
        "table": {
          "table_name": "company_descriptions",
          "access_type": "const",
          "possible_keys": [
            "PRIMARY"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "company_id",
            "lang_code"
          ],
          "key_length": "10",
          "ref": [
            "const",
            "const"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.00",
            "eval_cost": "0.10",
            "prefix_cost": "0.00",
            "data_read_per_join": "1K"
          },
          "used_columns": [
            "company_id",
            "lang_code",
            "company_description",
            "terms",
            "subdomain_colors",
            "i18n_company",
            "i18n_address",
            "i18n_city"
          ]
        }
      },
      {
        "table": {
          "table_name": "vendor_plan_descriptions",
          "access_type": "const",
          "possible_keys": [
            "PRIMARY"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "plan_id",
            "lang_code"
          ],
          "key_length": "10",
          "ref": [
            "const",
            "const"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.00",
            "eval_cost": "0.10",
            "prefix_cost": "0.00",
            "data_read_per_join": "1K"
          },
          "used_columns": [
            "plan_id",
            "lang_code",
            "plan"
          ]
        }
      },
      {
        "table": {
          "table_name": "seo_names",
          "access_type": "ref",
          "possible_keys": [
            "PRIMARY",
            "dispatch"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "object_id",
            "type",
            "dispatch",
            "lang_code"
          ],
          "key_length": "206",
          "ref": [
            "const",
            "const",
            "const",
            "const"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.87",
            "eval_cost": "0.10",
            "prefix_cost": "0.97",
            "data_read_per_join": "1K"
          },
          "used_columns": [
            "name",
            "object_id",
            "type",
            "dispatch",
            "path",
            "lang_code"
          ]
        }
      },
      {
        "table": {
          "table_name": "discussionA",
          "access_type": "const",
          "possible_keys": [
            "object_id"
          ],
          "key": "object_id",
          "used_key_parts": [
            "object_id",
            "object_type"
          ],
          "key_length": "6",
          "ref": [
            "const",
            "const"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.71",
            "eval_cost": "0.10",
            "prefix_cost": "1.78",
            "data_read_per_join": "24"
          },
          "used_columns": [
            "thread_id",
            "object_id",
            "object_type"
          ]
        }
      },
      {
        "table": {
          "table_name": "discussion_posts",
          "access_type": "ref",
          "possible_keys": [
            "thread_id",
            "thread_id_2"
          ],
          "key": "thread_id_2",
          "used_key_parts": [
            "thread_id",
            "status"
          ],
          "key_length": "6",
          "ref": [
            "goimagine.discussionA.thread_id",
            "const"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.25",
            "eval_cost": "0.18",
            "prefix_cost": "2.21",
            "data_read_per_join": "787"
          },
          "used_columns": [
            "post_id",
            "thread_id",
            "status"
          ]
        }
      },
      {
        "table": {
          "table_name": "discussion_rating",
          "access_type": "eq_ref",
          "possible_keys": [
            "PRIMARY",
            "thread_id"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "post_id"
          ],
          "key_length": "3",
          "ref": [
            "goimagine.discussion_posts.post_id"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.44",
            "eval_cost": "0.18",
            "prefix_cost": "2.82",
            "data_read_per_join": "28"
          },
          "used_columns": [
            "rating_value",
            "post_id",
            "thread_id"
          ],
          "attached_condition": "<if>(is_not_null_compl(discussion_rating), (`goimagine`.`discussion_rating`.`thread_id` = `goimagine`.`discussionA`.`thread_id`), true)"
        }
      }
    ]
  }
}

Result

company_id lang_code company_description terms subdomain_colors i18n_company i18n_address i18n_city status company address city state country zipcode email phone url storefront secure_storefront entry_page redirect_customer countries_list timestamp shippings logos request_user_id request_account_name request_account_data plan_id stripe_connect_account_id identifier_facebook_pixel featured_products sd_ga_tracking_code paypal_commerce_platform_account_id tagline url_facebook url_instagram url_twitter url_pinterest announcement shippo_api_token shippo_carrier shippo_service_type vendor_ga_tracking_code vendor_fb_tracking_code custom_domain custom_domain_status taxjar_key taxjar_export_statuses taxjar_export_csv_data ag_hide_city updated_timestamp suspend_date grace_period_start last_time_suspended last_debt_notification_time tax_number stripe_connect_account_type registered_from_storefront_id plan seo_name seo_path average_rating company_thread_ids
2604 en <hr> <p><span style="color: rgb(31, 73, 125);"><strong>Hello, and </strong><em><strong>welcome to my shop!</strong></em> <br><br>I am Ms. Terry, an independent small business owner, and I create all of my <strong>soap art</strong> and bath products by hand, in small, love-filled batches. Using the highest quality ingredients, I strive to create an experience, not just a product. <br><br>As we all know, handwashing is important- but that doesn't mean it has to be boring! Handwashing, bath time, shower time, skin care, and self-care can be fun, invigorating, or relaxing. I have a soap for everyone, and if not- I'll make one (custom orders welcome, possibly a small fee or minimum purchase). <br><br>No matter your skin type, I'll work to find the best options for your <strong>skin care routine</strong> and customize for allergies/sensitivities. Whether you like to soak in a spa-style salt, milk, or bubble bath, or you prefer to steam away your stress in the shower, I'll create a <strong>self care-collection</strong> perfect for you. I&nbsp;offer personalized, unique custom gift sets&nbsp;for your loved ones, co-workers, and host gifts.&nbsp;</span></p> <p></p> <hr> <p><span style="color: rgb(31, 73, 125);"></span></p> <p><span style="color: rgb(31, 73, 125);">Many of my soaps are vegan. All are free of harsh detergents, and use sustainable, non-GMO, cruelty-free ingredients. All ingredients are skin safe. Where possible and safe to do so, I choose environmentally friendly packaging, including short-life biodegradable shrink wrap. When I&nbsp;use bubble wrap to ship, it is recycled.&nbsp;</span></p> <p><span style="color: rgb(31, 73, 125);">Look around and please feel free to ask questions!&nbsp;</span></p> <hr> <p><em><span style="color: rgb(31, 73, 125);">PS: this is a new venue for me, so please forgive any mistakes, discrepancies, or other general weirdness, while I&nbsp;work to create a unique shop for your shopping enjoyment!</span></em></p> <p>Terms & Conditions:</p> <p>*no minimum order</p> <p>*I typically ship within 3-5 business days. Heavier traffic seasons may cause delays (Black Friday/Christmas).</p> <p>*custom orders ship in 1-2 weeks, possibly more for larger orders, please contact me for an estimate</p> <p>*I ship using USPS First Class & USPS Priority Mail, Priority Cubic, and Priority Mail Flat Rate through Pirate Ship- and I do not add a handling fee.&nbsp;</p> <p>*Orders cannot be canceled once they have shipped.</p> <p>*I am not shipping internationally at this time, please check back for changes.</p> <p>*Wholesale inquiries welcome, but I am a small, one-woman business. Some products are quite intricate, and I may not be able to offer at keystone. I may, however, be able to offer discounts for bulk orders. Please email me with your question or proposal.&nbsp;</p> <p>*Please send all inquiries to: ms.terrys.soapsnsuch@gmail.com or message me through Go Imagine</p> <hr> <p>Returns:<br></p> <p>Due to the personal nature of my items, I cannot accept returns, but I will do my best to ensure each customer is happy. If you have a problem with your order or my product, please do not hesitate to contact me through *email, and I will do my best to make it right. Please be considerate with this policy, as you are purchasing an intricate hand made item. No two will be exactly alike, small "flaws" may be considered part of the design, and scent is quite subjective.&nbsp;</p> <p>Please be on the lookout for your product, once it ships. As much as I would like to, I am a very small business and cannot afford to replace items that are stolen from your doorstep or left in the sun for days. If you may not be home during arrival, you may purchase a cooling pack with your order. <br><br>I have yet to ship a package that has arrived in poor condition. If your product arrives in damaged condition, please take pictures. Do not send me the product. Thank you.&nbsp;<br><br>*Please send questions or concerns to: ms.terrys.soapsnsuch@gmail.com. or message me through Go Imagine</p> <p><br></p> {"default_colors":"N","link_color":"#007d89","label_color":"#00a0af","icon_color":"#00a0af","main_btn_color":"#6dd1d6","branded_text_color":"#00a0af","vbp_1_url":"","vbp_2_url":"","vbp_3_url":"","vba_1_url":"","vba_2_url":"","vba_3_url":""} Ms. Terry's Soaps & Such 7173 63rd Street N Pinellas Park A Ms. Terry's Soaps & Such 7173 63rd Street N Pinellas Park FL US 33781 ms.terrys.soapsnsuch@gmail.com none Y 1625332324 0 2 acct_1J9DdfH91vP6Xgl8 make bath time fun again! https://www.facebook.com/msTsoap https://www.instagram.com/msterryssoapsnsuch/ https://twitter.com/MsTsoaps A N 0 0 0 0 0 S Growth Plan mstsoap 2604_0