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

Query time 0.00112

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.91"
    },
    "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.90",
            "eval_cost": "0.10",
            "prefix_cost": "1.00",
            "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.78",
            "eval_cost": "0.10",
            "prefix_cost": "1.87",
            "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.30",
            "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.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
71 en <p>Hello, I'm Andrea! I first <span class="JsGRdQ" style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">learned how to crochet, thanks to my dad (yes! dad!), when I was just a kid. While other things have come and gone, the love of texture art has stayed with me. My main love, and what I specialize in, amigurumi, came about 10 year ago thanks to my desire to make cute stuffed items. You may also see regular/non-stuffed knit or crochet items, but amigurumi is my main focus.&nbsp;</span></p> <p><span style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">All pieces in my store are made to order, unless otherwise stated. However, if there is something you'd like that you're not seeing, please reach out to me or <a href="https://goimagine.com/art/fiber-arts/custom-order-request/">start a custom made order</a>. I&nbsp;love to do custom pieces and it's very rare that I can't find something/come up with something that will work!&nbsp;</span></p> <p>Want to know more about me/my products? Check me out on social media!</p> <p><span style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">All items are made in a pet-friendly (dog/cat) and smoke-free home.&nbsp;</span><span style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;"></span><br></p> <p><b>Processing Time</b><br></p> <p>All items are made-to-order. While time needed to prepare orders for shipping averages between 2-3 weeks, please see individual listings for specific details. Please also check the store announcements for up-to-date information on delays.&nbsp;</p> <p><br></p> <p><b>Returns, Exchanges, or Cancellations</b></p> <p>Due to the nature of custom or personalized items, items cannot be returned/exchanged unless the item was received damaged or there was a mistake on my part.&nbsp;</p> <ul><li>Buyers must contact me within <b>7 days of delivery</b>.</li><li>Items must be shipped back within <b>14 days of delivery</b> if looking for a replacement.&nbsp;</li><li>If the item was damaged, I do request a photo of the packing and the item to show damage.&nbsp;</li></ul> <p><br></p> <p><b>For Items Returned to Sender due to incorrect or insufficient address</b></p> <ul><li>Buyer will be charged for the new shipping label. Since all items are custom made, I will not refund items.&nbsp;</li></ul> <p><br></p> <p><b>For Cancellations</b></p> <ul><li>You must contact me within <b>2 hours of purchase.</b></li></ul> <p></p> <p><b>Color Variations</b></p> <p>Colors may vary slightly due to device monitors, lighting, and yarn dye lots.&nbsp;</p> <p><b><br></b></p> <p><b>Shipping Issues</b></p> <ul><li>I ship all items via USPS & will have a tracking number.&nbsp;</li><li>I am unable to guarantee shipping times at any time. If an item hasn’t moved in two weeks, please let me know and I will file a lost/missing case with USPS.</li><li>If item says delivered but you have not received it, please try to following</li><ul><li>Go to your local USPS office and ask for GPS coordinates. They will be able to tell if the delivered coordinates match your address or not.&nbsp;</li><li>If GPS coordinates match your address, please check with other house members/neighbors if possible.&nbsp;</li><li>If still missing, please file a report with the local police station. Mail theft is a crime. Send me a copy of the report. Once I have verified it, I will send a replacement.&nbsp;</li></ul></ul> <p></p> <p>Please feel free to contact me if there are any other issues.&nbsp;</p> <p></p> {"tmenu_style":"H","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":""} Sowers Creations 1616 Richmond Circle Unit 303 Joliet A Sowers Creations 1616 Richmond Circle Unit 303 Joliet IL US 60435-6767 sowerscreations@gmail.com none Y 1584494737 0 a:4:{s:14:"company_fields";a:2:{i:37;s:6:"Andrea";i:38;s:6:"Sowers";}s:15:"admin_firstname";s:6:"Andrea";s:14:"admin_lastname";s:6:"Sowers";s:6:"fields";a:0:{}} 3 acct_1GR3GsEOZ5vBjDey 133406012140709 59062,276307,83388,83385,71634,87937,61087,87942 UA-176984593-1 https://www.facebook.com/sowerscreations https://www.instagram.com/sowerscreations/ <p>New items coming soon! Interested in a custom piece? Use the custom piece listing below!</p> UA-176984593-1 133406012140709 sowerscreations.com A {"items_per_file":"2500","time_from":"","time_to":""} N 0 0 0 0 0 S Professional Plan sowerscreations 5.0000 71_463