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

Query time 0.00190

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.77",
            "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.91",
            "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
68 en <p>Thank you for shopping Aris Designs! I offer a variety of sleek and stylish jewelry in solid Gold and Sterling Silver, with a specialty in hoop earrings. If you have any questions about my work, please send me a message. Thank you for shopping Handmade!</p> <p></p> <h1 class="text-center">Return Policy</h1> <p>We want you to LOVE your Aris Designs handmade jewelry. If your order does not meet your expectations in any way, a return or exchange may be done. Please notify us within 3 business days of receiving your order for an exchange or refund (excluding the original shipping costs and/or any restocking fees). Upon contacting us, further instructions will be provided on the return procedure.</p> <p><br></p> <ul><li>Items must be returned to us in their original condition and packaging. Items will not be refunded if we receive the item with signs of use or damage.</li></ul> <p><br></p> <ul><li>Package tracking is required on returns.&nbsp;We are&nbsp;only able to refund the purchase once the items safely back in hand, so insurance is also an option for your own protection. Aris Designs&nbsp;is&nbsp;not able to refund packages lost in the mail or damaged in transit.</li></ul> <p><br></p> <ul><li>Custom pieces are non-refundable and non-exchangeable.</li></ul> <p><br></p> <ul><li>Sale items are non-refundable.</li></ul> <p><br></p> <ul><li>Items that are shipped back without first contacting Aris Designs will be denied.</li></ul> <p><br></p> <ul><li>Once your return is received and inspected, we will send you an email to notify you that we have received your returned item. We will also notify you of the approval or rejection of your refund.&nbsp;&nbsp;If you are approved, then your refund will be processed, and a credit will automatically be applied to your credit card or original method of payment. The funds are generally available in your original payment account within 2-5 business days.</li></ul> <p><br></p> <h1 class="text-center">Shipping Policy</h1> <p>&nbsp;</p> <p>All Aris Designs jewelry is handmade to order specifically for you.&nbsp; Please see individual listings for processing times.&nbsp; Processing times are the longest expected time before shipment&nbsp;will&nbsp;occur.&nbsp; When time and supplies permit, we may ship your product much sooner than indicated by the processing time.&nbsp; If you do not want your order to arrive prior to a certain date, please contact me with this information.&nbsp; Similarly, if you need the item sooner than processing times indicate, contact me to see if this can be arranged.&nbsp; A rush fee may be added to your order.&nbsp; Due to limitations outside of our control with shipping carriers, Aris Designs cannot guarantee a specific delivery date, but we can guarantee a ship by date.</p> <p><br></p> <p>Free First-Class domestic shipping via USPS is offered on all orders from Aris Designs.&nbsp; If you would like your order sooner, please consider upgrading to Priority shipping to improve shipping speed. Selecting upgraded shipping will not change the date your order is shipped.</p> <p><br></p> <p>Your order will be packaged in an Aris Designs branded jewelry box and wrapped with a ribbon.&nbsp; We use padded bubble mailers for shipping.&nbsp;&nbsp;</p> <p><br></p> <p>Shipping damage is rare, but it can occur.&nbsp; If your package arrives with signs of shipping damage, please take photographs of the package before opening.&nbsp; If you open your damaged package to find your jewelry is also damaged, please take pictures of this as well.&nbsp; The photographs may be required for shipping insurance claims and/or product replacement.&nbsp; Contact Aris Designs immediately upon receipt of a damaged package.</p> <p><br></p> <p>Once your package has been marked as Delivered by the postal carrier, Aris Designs is not responsible for the package.&nbsp;&nbsp;However, if you do not receive your package that shows it was delivered&nbsp;via&nbsp;the tracking, please contact Aris Designs immediately as there may be steps you are able to take with the Postal Service to receive your mis-delivered package.</p> <p></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":""} Aris Designs Tucson A Aris Designs Tucson OR US 97051 Andrea@Aris-Designs.com none Y 1584480214 0 a:4:{s:14:"company_fields";a:2:{i:37;s:6:"Andrea";i:38;s:8:"Icenogle";}s:15:"admin_firstname";s:6:"Andrea";s:14:"admin_lastname";s:8:"Icenogle";s:6:"fields";a:0:{}} 2 acct_1GO4stHpOOQ6yDq8 UA-177197152-1 V34VC9RJWCMS2 UA-177197152-1 A {"items_per_file":"2500","time_from":"","time_to":""} N 0 0 0 0 0 S Growth Plan arisdesigns 68_0