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

Query time 0.00239

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.76"
    },
    "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.84",
            "eval_cost": "0.10",
            "prefix_cost": "0.94",
            "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.67",
            "eval_cost": "0.10",
            "prefix_cost": "1.72",
            "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.14",
            "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.76",
            "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
6245 en <p>Hi! My name is Desiree and my products are made “by Dez”ign. I am married to <br>my high school sweetheart and we have 3 beautiful girls.<br><br>Life has been a roller coaster the past few years, so now I need some “me” time! <br>I am starting out with money leis for now, but I am hoping to add to my little shop <br>whenever time allows. By “time allows”, it all depends on what I can get done with <br>my ever curious 10 yr old daughter and my double-the-trouble-double-the-love <br>9 yr old twin girls. :)<br><br>Feel free to contact me with any questions!</p> <p><span style="color: rgb(128, 100, 162);">CANCELLATIONS<br></span>Requests for cancellations must be made before a shipping label has been created.<br>That being said, I usually print a shipping label the day after an order clears payment<br>since most of my items are already made and ready to ship (unless otherwise noted).</p> <p><span style="color: rgb(128, 100, 162);">REFUNDS</span><br>I hope you love your purchase from By Dezign, but if for some reason you are<br>unsatisfied with your item, please contact me right away to discuss.</p> <p>• I will refund the purchase price of the item minus the cost of shipping upon receiving<br>and inspecting the item.<br>• Items must be in their original condition (no signs of usage, no damage, no strong<br>scents such as cigarette smoke or perfume, no pet hair, etc).<br>• Return shipping is the buyer's responsibility (including tracking).</p> <p><span style="color: rgb(128, 100, 162);">RESERVED / PRIVATE LISTINGS</span><br>If you purchase an item that has been reserved for somebody else, the order will be <br>canceled and refunded. Reserved/Private items will be noted in the listing titles and <br>within the item description.</p> <p><span style="color: rgb(128, 100, 162);">PAYMENT</span><br>Payment is due at the time of checkout. &nbsp;The order will be processed after payment<br>has cleared.</p> <p><span style="color: rgb(128, 100, 162);">SHIPPING<br></span>*** Please note when placing an order that the USPS website states possible extended<br>delivery times due to Covid. ***</p> <p>• Items are shipped via USPS Priority Mail and are estimated to arrive 1 - 5 business <br>days after the package has been dropped off to the post office. I will email tracking <br>information with the estimated delivery date when your order ships.<br>• Orders shipped to APO/AFO (military bases) will be sent via Priority Mail but will take <br>longer to arrive.<br>(https://about.usps.com/publications/pub640/pub640_v02_revision_122015_tech.htm)<br>• I ship to the address given to goimagine during checkout, so please make sure it is <br>correct. If the address provided is "unverified" by USPS, I will contact you to confirm<br>details. This may delay shipping depending on response time.<br>• Packages that are delivered to an incorrect or old address and are not returned to me <br>will not be refunded.<br>• I am not responsible for any delayed, damaged, lost, or stolen packages after they <br>have been delivered.<br>• If mail theft is an issue in your area, please contact me to add signature confirmation <br>to your order (fees may apply). Items without signature confirmation are left to the mail <br>carrier's discretion (in the mailbox, on the porch, etc).<br>• I only ship to the US at this time.&nbsp;</p> <p><span style="color: rgb(128, 100, 162);">CUSTOM REQUESTS</span><br>I am a stay-at-home mom to 3 beautiful girls (10 yr old and 9 yr old twins), so I am <br>unable to take custom requests at this time. However, please do feel free to convo me <br>with any questions.</p> <p><br></p> {"tmenu_style":"H","default_colors":"N","link_color":"#78475f","label_color":"#a36c87","icon_color":"#bb8fa5","main_btn_color":"#8e4b6c","branded_text_color":"#b992a6","vbp_1_url":"https:\/\/bydezign.goimagine.com\/money-leis\/","vbp_2_url":"","vbp_3_url":"","vba_1_url":"","vba_2_url":"","vba_3_url":""} By Dezign 2747 La Costa Drive Brentwood A By Dezign 2747 La Costa Drive Brentwood CA US 94513 dez@bydezign.com +15106736905 none Y 1649281710 0 3 acct_1KmnZzBXRgejKBPP 204859,294969,284348,204947,284699,295126,286220,294961,288397,204830,221677,221445,204846,284373 Money leis and other handmade gifts for your special event... UA-226187590-1 A {"items_per_file":"2500","time_from":"","time_to":""} N 0 0 0 0 0 S Professional Plan bydezign 5.0000 6245_1580502