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

Query time 0.00522

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.81"
    },
    "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.86",
            "eval_cost": "0.10",
            "prefix_cost": "0.96",
            "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.71",
            "eval_cost": "0.10",
            "prefix_cost": "1.77",
            "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.19",
            "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.81",
            "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
8122 en <p>Hello all. My name is Jill and I live in a small mountain town called Big Stone Gap, VA. I am a wife, mother, and dog lover. I grew up in Newark, DE and moved to the country when our son was a baby for a quieter life. The mountains sure have delivered. While I have enjoyed the peace and slower way of life, I did find myself wanting to find a hobby. I worked in direct sales selling candles and wax melts for years, because I, like most girls, had to have all the smell goods. So I decided I would attempt to make my own. I was not only successful, but found so much happiness in curating something that smelled so amazing. I then started making soaps and a few other things and became completely obsessed with making (in a good way LOL)!</p> <p>So since have always had a passion for smell goods and have now found this love for creating by hand. I am so excited to share them with you! Handcrafting candles, soaps, wax melts, and more brings me such joy and I hope you feel the same way when you open your package.</p> <p>XOXO,</p> <p>Jill</p> <p><em>Thank you for supporting small handmade businesses. Please review product care instructions and other policies below.</em></p> <p><strong>Candle Care:</strong> Your candle has arrived and you can't wait to light it up, but let's chat for a moment. Wooden wick candles can be a little tricky if you aren't used to them. Make sure you trim your wicks 1/5 to 1/4 inch before your first burn, but be careful to not trim to short or the wax will drown your wick. Once you find the sweet spot, just maintain throughout your future burns. Always keep your wick trimmed and allow a full melt pool (wax melted to all sides) before you extinguish. Make sure your candles are burned on flat surfaces away from flammable materials, drafts, fans, etc. Since I use 100% natural soy, you will occasionally see frosting (white spots) on your wax. This is completely normal. Your product is not dried out and will melt just as beautifully. Our candles last approximately 50-70 hours.</p> <p><strong>Wax Melt Care: </strong>Simply pop out a cube or two of your scented wax melts and watch them begin to shimmer as they heat and melt. Our 6 pack of melts easily lasts 30+ hours.&nbsp;</p> <p><strong>Soap Care: </strong>Lather and rinse. To extend the live of your soap bars, we do suggest storing in a cold, dry area.</p> <p><em>All products should be kept out of the reach of pets and children. Soap products many be sensitive to younger skin so use caution and test before full body use. Please review ingredients and avoid use if you have an allergy to any ingredients.</em></p> <p><strong>Processing Times:</strong> Orders are processed and shipped within 2-5 business days in most cases. Please keep in mind, this is the timeframe for me to process and ship. This does not include shipping times. I am not responsible for delays caused by USPS.</p> <p><strong>Return/Refund Policy:</strong> Returns are NOT accepted, however, if you order is incorrect or damaged, I will gladly correct the issue with a new shipment or refund. Orders that fail to arrive or are damaged by the shipping provider will sometimes require you to submit a claim with USPS.</p> {"tmenu_style":"H","default_colors":"N","link_color":"#000000","label_color":"#923d67","icon_color":"#7b3457","main_btn_color":"#913e67","branded_text_color":"#98476f","vbp_1_url":"","vbp_2_url":"","vbp_3_url":"","vba_1_url":"","vba_2_url":"","vba_3_url":""} Clean Glow Co 11 E 23rd St N Big Stone Gap A Clean Glow Co 11 E 23rd St N Big Stone Gap VA US 24219 cleanglowcompany@gmail.com +12762192726 none Y 1668377242 0 4 acct_1KW0znAxRspmcMND 288265,288269,288270,288373,288414,288417,284345,265555,265640 Naturally Based - Small Batch - Handmade Products https://www.facebook.com/cleanglowco https://www.instagram.com/cleanglowco/ https://www.pinterest.com/cleanglowco/ <p>Free Shipping on Orders $100+ | Thank you for shopping small!</p> oauth.mSviDAS8j2HwEcEbiNtf2fM5dOvsf503XS9hBlBS.LXpP7_6pz3yBMuWNUf7uQ5ZoqhLgXFV1Ku_VUeHxYRY cleanglowcompany.com A {"items_per_file":"2500","time_from":"","time_to":""} N 0 0 0 0 0 S All-Star Plan cleanglowco 8122_0