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

Query time 0.00129

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.84"
    },
    "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.72",
            "eval_cost": "0.10",
            "prefix_cost": "1.80",
            "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.22",
            "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.84",
            "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
980 en <p><span style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">Welcome to Areen Creations, we are&nbsp;happy you're here.</span><span class="Apple-converted-space" style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">&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;"> We are located in Miami, Florida where each piece of jewelry is designed and handcrafted.</span><span class="Apple-converted-space" style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">&nbsp;&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;">In this shop you will find modern jewelry using elements of bead, brass, clay or fine metals. Our&nbsp;earrings, necklaces, bracelets and&nbsp;accessories feature minimalistic and modern lines for a simple or bold statement.</span><span class="Apple-converted-space" style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">&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;">I hope you'll find a special design piece you love.&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;">&nbsp;If you have any questions, don't hesitate to ask!&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><span style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">Thanks for stopping by.</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></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;">✉️Join the mailing list and get 20% off your first order:&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;">&nbsp;</span><a href="http://eepurl.com/gGeOMv" style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">http://eepurl.com/gGeOMv</a><br></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;"></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;">Email support contact:&nbsp;</span><a href="mailto:info@areencreations.com" target="_blank" style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">info@areencreations.com</a><span style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;"></span></p> <p>Website:&nbsp;<a href="https://areencreations.com">https://areencreations.com</a></p> <h6 class="text-justify"><span style="color: rgb(49, 133, 155);"><strong>Processing Time:</strong></span></h6> <p>The time to prepare an order for shipping varies. For details, see individual items.</p> <h6 class="text-justify"><span style="color: rgb(49, 133, 155);">Returns&nbsp;</span><strong><span style="color: rgb(49, 133, 155);">& Exchange Policy:</span></strong></h6> <h6 class="text-justify"><strong><span style="color: rgb(192, 80, 77);"></span></strong></h6> <h6 class="text-justify"><strong><span style="color: rgb(192, 80, 77);"></span></strong></h6> <p>We want you to love your purchase. However if you are not completely satisfied, you may return or exchange your purchase within 30 days from the date received for a refund.<span class="Apple-converted-space">&nbsp;</span><span class="Apple-converted-space">&nbsp;</span><br><br>Important:<br>• Please contact us within 14 days of receipt at Goimagine message board or by email&nbsp;<a href="mailto:info@areencreations.com" target="_blank">info@areencreations.com</a>&nbsp;before returning your item.<span class="Apple-converted-space">&nbsp;</span><br>• Buyer will be responsible for any shipping costs for returns or exchanges.<br>• Items must be returned/exchanged with original packaging and in original unworn condition within 30 days of receipt.<span class="Apple-converted-space">&nbsp;</span><span class="Apple-converted-space">&nbsp;</span><br>• Custom orders are not eligible for returns or exchanges.<br>• Refund will be made less any shipping costs paid when item returned is received by the shop.<br></p> {"tmenu_style":"V","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":""} Areen Creations 7130 NW 177 ST, 206 Hialeah A Areen Creations 7130 NW 177 ST, 206 Hialeah FL US 33015 areencreations@gmail.com none Y 1596655265 0 a:4:{s:14:"company_fields";a:2:{i:37;s:6:"Kareen";i:38;s:4:"Reid";}s:15:"admin_firstname";s:6:"Kareen";s:14:"admin_lastname";s:4:"Reid";s:6:"fields";a:0:{}} 2 acct_1GzXINKSYzQabzKg 284974,159584,146327,204532,284976,82073 UA-176997466-1 S5KPC9QC3TMR4 Bead, Brass & Polymer Clay Modern Statement Jewelry https://www.facebook.com/AreenCreations https://www.instagram.com/AreenCreations https://www.twitter.com/AreenCreations https://www.pinterest.com/AreenCreations <p><b>FREE Standard Shipping on most items! &nbsp;$4 Flat Rate Shipping.</b></p> UA-176997466-1 A {"items_per_file":"2500","time_from":"","time_to":""} N 0 0 0 0 0 S Growth Plan areencreations 980_0