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

Query time 0.00097

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.69"
    },
    "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.83",
            "eval_cost": "0.10",
            "prefix_cost": "0.93",
            "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.62",
            "eval_cost": "0.10",
            "prefix_cost": "1.65",
            "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.07",
            "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.69",
            "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
5370 en <p>Hi there!&nbsp;I'm Ashley and I&nbsp;am so very grateful you're here.&nbsp;</p> <p>I&nbsp;have been creating with polymer clay since 2017 and began as a creative outlet to recover from the hectic full time work week. As a woman in her thirties, with a full time job and diagnosed ADHD, I am thankful everyday to have found creating with this medium. It has taken me some time, and loads of trial and error, to find a style that truly represents who I&nbsp;am, but am happy to introduce it to you here.&nbsp;</p> <p>There is never any boredom with polymer clay, because the possibilities are truly endless. I love finding new and creative ways to use tools meant for other things to create patterns, textures and colors with my jewelry.&nbsp; There is so much joy in creating unique, one of a kind jewelry.&nbsp;&nbsp;</p> <p>My other passion includes gardening and spending as much time as possible in nature. My love for growing and the outdoors is represented in my jewelry, both in obvious and subtle ways.&nbsp;</p> <p>Thank you again for being here and for supporting Attis Bloom Designs.&nbsp;</p> <p>Attis - "minor god of vegetation".&nbsp;</p> <ul><li><strong>Processing Time:</strong>&nbsp;</li><li>Orders will be processed in 1-3 business days.&nbsp;</li><li><strong>Care Instructions:</strong>&nbsp;</li><li>1. Hand with Care. Small details on your earrings will be delicate. Please use care when putting them on and taking them off. Always get dressed before putting on your earrings, and take them off before undressing.&nbsp;</li><li>2. Keep them clean. Use a dry or wet cotton bud to remove dust, lint, and makeup. Never apply any abrasive material or harsh chemicals.&nbsp;</li><li>3. Avoid getting wet. Although polymer clay can withstand getting wet, it is best to avoid showering and swimming with your new jewelry. Metal findings could discolor if subject to wet conditions and/or chemicals.&nbsp;</li><li>4.&nbsp;Store them safely. Although durable against accidental drops, it's best to store your new jewelry where it is safe from being scratched against other objects. Jewelry displays are usually best.&nbsp;</li><li><strong>FAQ's:</strong>&nbsp;</li><li>1. Clay? They must be very heavy? - Not even a little. Each earring weighs in between&nbsp;0.2-0.6 ounces.&nbsp;</li><li>2. What type of metal do you use for the findings? - All metal jewelry findings on this website are hypoallergenic and 100% nickel free. In addition, each earring will include the metal type in the description.&nbsp;</li><li>3. Can you make _ in _ color? The short answer is yes, eventually. At the moment I&nbsp;do not have availability for custom orders. However, when restocking styles of earrings, I'm happy to accommodate color requests in most cases.&nbsp;</li><li><strong>Return/Refund Policy:</strong>&nbsp;</li><li>All refund requests will be reviewed within 1-3 business days of request. Photo's and/or documentation must accompany request, with description of why the refund is being requested. If the refund request is accepted, there will be a minimum $5 withheld. You will be notified by email if the refund amount withheld is more than $5. Due to diligence in keeping my products clean and hygienic - product cannot be resold.&nbsp;&nbsp;</li></ul> {"tmenu_style":"H","default_colors":"N","link_color":"#741b47","label_color":"#a64d79","icon_color":"#c27ba0","main_btn_color":"#ff00ff","branded_text_color":"#ead1dc","vbp_1_url":"","vbp_2_url":"","vbp_3_url":"","vba_1_url":"https:\/\/instagram.com\/attis.bloom?igshid=YmMyMTA2M2Y=","vba_2_url":"","vba_3_url":""} Attis Bloom Designs 1232 W Airy Street Norristown A Attis Bloom Designs 1232 W Airy Street Norristown PA US 19401 attisbloomdesigns@gmail.com +13039814019 none Y 1644456241 0 4 acct_1KSY6FIGlFpqn3Qa 219600,216272,219598,219648,219360,216273,219650,216270,219587,219357,219356,219363,219585,206323,216361,219595,207419,207708,207404,207411,207706,216366,216336 EY93WVXXJNU9S Inspired by nature - Small batch jewelry and crafts made from polymer clay https://www.facebook.com/attis.bloom https://www.instagram.com/attis.bloom/ www.pinterest.com/attisbloomdesigns <p>Welcome to Attis Bloom Designs! Enjoy free shipping on orders over $40.00</p> oauth.jDdWja-hYqF1MLYTU7twQipAq-HnERFvCNsX7sah.TanIyZv_DGMSGqknNxbETS7rqdP5pqwaDE0s8-OGlOQ UA-230039737-1 attisbloomdesigns.com A N 0 0 0 0 0 S All-Star Plan attisbloomdesigns 5370_0