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

Query time 0.00383

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.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.88",
            "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
176 en <p>We specialize in premium, personalized gifts at competitive prices. At Rustic Route Designs we love celebrating with you! Whether you are shopping for&nbsp; Birthdays, Anniversaries, Graduations or even Engagement and Weddings, we will help you create the custom gift you have been dreaming of!!</p> <p>We design, print and engrave each product in our Rural North Carolina shop.&nbsp; We thrive when creating custom designs that are meaningful to you and your loved ones.</p> <p>• Free personalization & customization<br>• Premier Customer Service<br>• Highest Quality Brand Name Products<br>*All of our designs are transferable-meaning we can put any one of our designs on any product (color options may vary). We welcome your questions at all times via Etsy messages.</p> <p>Follow us on Facebook and Instagram (@RusticRouteDesigns) to find our latest products and deals and share your photos at #rusticroutedesigns</p><p></p> <p>If you received a damaged or defective product you have 3 days to report it to us at sales@rusticroutedesigns.com with a high resolution picture of the damaged item and the box it arrived in.&nbsp; Rustic Route Designs will gladly replace your damaged product at no charge.</p> <p><br>Mistakes happen! If you accidentally approved a proof which was incorrect, we will replace that order for you at half the cost.<br><br>If we make the mistake, we will undoubtedly ship your replacement ASAP.</p> <p><br></p> <p><strong>CANCELLATION POLICY::</strong></p> <p>We will happily cancel your order as long as the cancellation request is issued to Rustic Route Designs within 24 hours of order being placed & if the artwork has not been assigned to our Graphic Design&nbsp;Department at the time of request.</p> <p><br></p> <p><strong>PROCESSING TIMES:</strong>:</p> <p><b>At Rustic Route Designs we make processing and shipping speed our top priority. We know that when you fall in love with a personalized product, you would like to receive it as soon as possible.</b> </p> <p><b>Orders will be produced and shipped within 3-5 business days; however, we usually produce and ship within 48 to 72 hours when it is not a busy time of year, as long as we are able to reach you for artwork approval.</b></p> <p><b>It is important to remember that all time frames are ESTIMATES not a guarantee, however we do our very best to meet these time frames and will communicate with you if we are experiencing a delay.</b>&nbsp; </p> <p><br></p> <p><br></p> <p><strong>SHIPPING POLICY::</strong></p> <p><b>All orders ship via USPS and can take 2-5 business days to arrive once shipped. We are not responsible&nbsp;for late packages due to USPS delays.</b></p> <p><b>If you require faster SHIPPING you can reach out to us via the message center or via email at sales@rusticroutedesigns.com to arrange shipping and rates that will fit your needs prior to purchase completion.</b></p> <p></p> <p><b>We DO NOT ship Internationally&nbsp;via GoImagine. If you are an International customer you can visit us at </b><a href="http://www.RusticROuteDesigns.com" style="font-weight: bold;">www.RusticRouteDesigns.com</a><b>&nbsp;for International shipping rates.</b></p> <p><br></p> <p><strong>RETURNS & EXCHANGES</strong></p> <p>We do not accept returns or exchanges for custom engraved & printed items at this time.</p> <p><strong>RETURN:</strong>: If you have chosen one of our house designs without any customization, we will happily accept a return as long as we receive the item back with in 7 business days of delivery. We will issue a refund with in 24 hours of receiving the item back in the same (NEW) condition it was sent in. ALL RETURNS MUST HAVE TRACKING</p> <p><strong>EXCHANGE::</strong>&nbsp;If you have chosen one of our house designs without any customization, we will happily accept an exchange as long as we receive the item back with in 7 business days of delivery.&nbsp; A full refund will be issued at that time and you will need to place a new order for the exchange request. ALL RETURNS MUST HAVE TRACKING</p> <p>All items need to be returned to Rustic Route Designs with tracking at buyers expense.</p> <p>RUSTIC ROUTE DESIGNS</p> <p>PO BOX 1283</p> <p>DENTON, NC 27239</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":""} Rustic Route Designs 1116 NC Hwy 801 N, #3 Advance A Rustic Route Designs 1116 NC Hwy 801 N, #3 Advance NC US 27006 sales@rusticroutedesigns.com none Y 1585253311 0 a:4:{s:14:"company_fields";a:2:{i:37;s:3:"Kim";i:38;s:4:"Rose";}s:15:"admin_firstname";s:3:"Kim";s:14:"admin_lastname";s:4:"Rose";s:6:"fields";a:0:{}} 4 acct_1GRLiCGILXwkT2xt UA-203322137-1 UA-203322137-1 A {"items_per_file":"2500","time_from":"","time_to":""} N 0 0 0 0 0 S All-Star Plan rusticroutedesigns 176_0