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

Query time 0.00336

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.62"
    },
    "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.79",
            "eval_cost": "0.10",
            "prefix_cost": "0.89",
            "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.60",
            "eval_cost": "0.10",
            "prefix_cost": "1.58",
            "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.01",
            "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.62",
            "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
418 en <p><strong><span style="color: rgb(63, 49, 81);"></span></strong></p> <p><b>Hello and welcome to my shop. My name is Janet and&nbsp;I have been designing and making jewelry for almost 20 years. I still love doing it every day. I am always looking for new ideas and my inspiration can come from anywhere&hellip; Whether&nbsp;it's walking on the beach, in the park or around the neighborhood. Sometimes I will see something, a color or a shape, and I will think&hellip;&nbsp;Wow, that would make an awesome pendant or earring and I can't wait to get home and get started on it. I have even been known to get up in the middle of the night to start a project so I don't forget it by morning.</b></p> <p><b>I am a happily retired wife and I have two wonderful sons. They have blessed me with two awesome daughters-in-law&nbsp;and six beautiful grandchildren.&nbsp;</b></p> <p><b>A few years ago, I was diagnosed with Parkinson's. I never imagined that I would have this disease. But, I decided that it was not going to beat me so I went at it head on! With the help of an awesome neurologist and some really good meds, I only have it in my left wrist so far. It hasn't spread any further, but, it still makes making jewelry an adventure, to say the least. When my tremors start or become bad, usually, I can sit down at my work bench in my studio and start working on a piece of jewelry and within five or ten minutes the tremors will go away. And, that's a good thing.</b></p> <p><span style="color: rgb(63, 49, 81);"><b>Anyway, please, take a few minutes to look around while you're here. I hope you find something you like. Since everything is handmade by me, I&nbsp;don't list it in my shop until it's ready to ship so t</b><span class="bumpedfont20"><b>here is&nbsp;</b></span><b><span style="color: rgb(63, 49, 81);">NO WAIT TIME</span>.&nbsp;</b></span><b>I usually ship out the same day or the next. I look forward to hearing from you.</b></p> <p><span style="color: rgb(63, 49, 81);"><strong></strong></span></p> <p><strong><span style="color: rgb(63, 49, 81);"></span></strong></p> <p></p> <p><strong><span style="color: rgb(95, 73, 122);">PROCESSING AND SHIPPING TIMES:</span></strong></p> <p></p> <p><span style="color: rgb(95, 73, 122);">I need very little time to prepare an order because every item listed in my shop is already made and ready to ship. I can usually get your order packed and shipped the same day I receive it. However, if I don't get it until after maybe 2pm Pacific Time, I probably won't get it out until the next day. The only things that will be later shipping are custom made items. The shipping time on those items will vary and will be discussed with you before the item is even made.</span></p> <p><span style="color: rgb(95, 73, 122);"><br></span></p> <p><span style="color: rgb(95, 73, 122);"><strong>DELIVERY TIMES:</strong><br></span></p> <p><span style="color: rgb(95, 73, 122);">I cannot guarantee delivery times right now.. Actual delivery time will depend on the USPS and we all know that our mail system has been hit hard with the COVID-19 Pandemic. Once your package leaves my hands, it is in the hands of the Post Office and we are at their mercy as to when it will be delivered. Usually, the mail is getting back to normal, but, it could always take longer. I will send you a tracking number and you can see exactly where your package is at all times.&nbsp;</span></p> <p><span style="color: rgb(95, 73, 122);"><br></span></p> <p><span style="color: rgb(95, 73, 122);"><strong>RETURNS, EXCHANGES & CANCELLATIONS:</strong><br></span></p> <p><span style="color: rgb(95, 73, 122);">I'm sorry, but, due to the Pandemic, I can not accept returns or exchanges at this time (This may change later), so please read the description carefully of the piece or pieces you are buying. If further information is needed, send me a message and I will try to answer your questions. I want you to be happy with your purchase and feel comfortable buying from me, so, feel free to ask me questions before you buy!&nbsp;</span></p> <p><span style="color: rgb(95, 73, 122);">I will accept cancellations if you can get a message to me before your order is shipped.</span><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":""} Jewelry by JP 7308 Grandball Way CITRUS HEIGHTS A Jewelry by JP 7308 Grandball Way CITRUS HEIGHTS CA US 95621 jpitzner@yahoo.com none Y 1587379597 0 a:4:{s:14:"company_fields";a:2:{i:37;s:6:"Janet ";i:38;s:7:"PITZNER";}s:15:"admin_firstname";s:6:"Janet ";s:14:"admin_lastname";s:7:"PITZNER";s:6:"fields";a:0:{}} 4 acct_1GfDnvEVxCGgp3wr Jewelry by JP 55233,58800,57106,58368,58850,274356,45790,70636,80035,80063,80032,80068 UA-177197983-1 GM7GS44LAVEBJ One-of-a-Kind & Custom Made Jewelry UA-177197983-1 Jewelry by JP jewelrybyjp.com A Y 0 0 0 0 0 S All-Star Plan jewelry-by-jp 5.0000 418_618