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 = 8287 
  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 = 8287

Query time 0.00106

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.92"
    },
    "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.82",
            "eval_cost": "0.10",
            "prefix_cost": "0.92",
            "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.63",
            "eval_cost": "0.10",
            "prefix_cost": "1.66",
            "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.08",
            "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.66",
            "eval_cost": "0.18",
            "prefix_cost": "2.92",
            "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
8287 en <p>Hi everyone! My name is Monica, and I'm the proud owner of Crochet Jamboree. Although I knit and sew too, crochet is my passion. I love all things yarn! My mom taught me to knit, and my great-aunt taught me to filet crochet when I was a young child growing up in Spain. As a child, I mostly knitted hats and scarves for my family, friends, and myself. Eventually, I graduated to knitting sweaters :)<br></p> <p> I picked up crocheting again a few years ago to make little clothes for the Waldorf dolls I was making for my children. Since then, crochet has become an addiction! I love how many different stitches I can create, how versatile the art is, and how easy it is to keep a hook and some yarn in my purse so I can create wherever I go!</p> <p> Over the years, the crocheters and knitters in my family have kept my family supplied with all kinds of handmade clothing and blankets, and I loved it. These pieces are timeless and still cherished to this day. Some are waiting in the attic for my grandchildren to use. Over the years, I have also crafted little clothes for my children and, later, as baby shower gifts.</p> <p> Crochet Jamboree is an outlet for my hobby! As crochet machines do not exist, all crochet is handmade and one of a kind. All my creations have been handcrafted with care, attention to detail, and love by me. Everything in my shop is ready to ship. All items are crocheted in a smoke-free and pet-free environment (we are pet lovers here, but allergies mean my orange cat Tangerina lives outdoors; she seems to enjoy it!).</p> <p> As I complete projects, I post them, so visit my store often! You can also follow my new Instagram and Facebook pages to see what I am working on next. Please don't hesitate to message me with any questions.</p> <p> Thank you for all of your support!</p> <p> Monica</p> <p></p> <p><strong><span style="color: rgb(128, 100, 162);"></span></strong></p> <p><strong><span style="color: rgb(149, 55, 52);">SHIPPING</span></strong><br></p> <p><strong>USPS Continental US only </strong>(comes with a tracking number, which I will share with you).&nbsp;</p> <p><strong>Processing Time:</strong> 2–3 business days.</p> <p><strong>Estimated Shipping Times in North America:</strong>&nbsp;Usually it is 3–7 business days, but it can be longer if USPS has delays. <span style="color: rgb(192, 80, 77);">Estimated shipping times are not guaranteed.</span> Tracking should show where the package is at all times, so as long as it moving, it is coming&nbsp;to you.</p> <p>Please contact me if there are problems with the delivery. If a package is lost or its contents are damaged, I will reimburse you and submit a missing mail search request ad/or an insurance claim.<br></p> <p><b><span style="color: rgb(149, 55, 52);">CANCELLATIONS</span></b><span style="color: rgb(149, 55, 52);">&nbsp;</span></p> <p>Accepted within 24 hours.</p> <p><b><span style="color: rgb(149, 55, 52);">&nbsp;RETURNS&nbsp;</span></b></p> <p>&nbsp;&nbsp;**<b>PLEASE CONTACT ME IF YOU HAVE A PROBLEM OR ISSUE WITH YOUR ORDER.</b></p> <p><b>I want you to be completely satisfied with your purchase.&nbsp;</b>Please read the item’s description carefully. I include a lot of photos, and I am happy to answer any questions you may have about an item. If you don't receive the item that you ordered, or it shows up significantly different from its description, please contact me.&nbsp;<span style="color: rgb(192, 80, 77);">I will only refund your purchase after you return the item(s)</span><span style="color: rgb(192, 80, 77);">&nbsp;in their original, new, clean condition. The buyer is responsible for shipping costs.</span></p> <p>Thank you for your support!</p> <p>Monica&nbsp;</p> <p><br><br></p> <p><strong><span style="color: rgb(128, 100, 162);"><em></em></span></strong></p> {"tmenu_style":"V","default_colors":"N","link_color":"#007d89","label_color":"#007377","icon_color":"#007377","main_btn_color":"#6dd1d6","branded_text_color":"#007377","vbp_1_url":"","vbp_2_url":"","vbp_3_url":"","vba_1_url":"","vba_2_url":"","vba_3_url":""} Crochet Jamboree Kingston Springs A Crochet Jamboree Kingston Springs TN US 37082 mail4mgjohnson@gmail.com +16159524218 none Y 1669566227 0 1 acct_1M9FpAEDwlxX8onR 297511,286216,265004 Handmade with Love for Babies https://www.facebook.com/profile.php?id=100087556265368 https://www.instagram.com/crochet_jamboree/ <p><em><span style="color: rgb(192, 80, 77);">Thanks so much for visiting my store! I hope you find that new special something for your little one :)&nbsp; (All my items are ready to ship).</span></em></p> UA-251666126-1 A N 0 0 0 0 0 S Starter Plan crochetjamboree 8287_0