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

Query time 0.00335

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "3.09"
    },
    "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.95",
            "eval_cost": "0.10",
            "prefix_cost": "1.05",
            "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.90",
            "eval_cost": "0.10",
            "prefix_cost": "2.05",
            "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.47",
            "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": "3.09",
            "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
3221 en <p>Melodie (AKA Crazy Tea Lady) is a Christian wife, mother, grandmother, daughter, sister, and friend. She is an entrepreneur with a creative spirit. She enjoys a good cup of coffee or tea and is always willing to share. Melodie is the founding owner of Steep Right Up&trade;️(formerly Tea, Cup & Kettle). She is a Certified Professional Aromatherapist and an Herbalist for over 25 years and has brought her experience and knowledge of oils and herbs to the business of tea. She has taken the time over the years to expand her knowledge of teas, herbs, and blending through reading, taking classes, and personal experience through trial & error. She takes her time creating her blends and loves the challenge of creating custom blends for her customers and for a cause.</p> <p>When Melodie is not working on her business she is spending time with her family. She has a husband, 4 boys (all grown), and so far 4 grandchildren. She also enjoys reading, crocheting, soap making, resin crafting, and Bible journaling. All of which go perfectly with a nice cup of tea.</p> <p>It is my desire to introduce the love of tea to as many as I can. I'm looking forward to brightening your day one cup and one sip at a time!</p> <p></p> <p>Our Disclaimer, Return and Shipping Policies can be seen below.&nbsp; To view our complete company policies please visit: <a href="https://steeprightup.com/compay-policies/"></a><a href="https://steeprightup.com/compay-policies/" target="_blank">https://steeprightup.com/company-policies</a></p> <p><b>Returns/Refunds/Exchanges:</b><br></p> <p>We want all of our customers to be happy with their purchases. If you purchase one of our regularly stocked products (excludes custom – see below regarding custom products) and are not happy with it please contact us.</p> <p>We do not offer returns, refunds, or exchanges on custom orders unless there has been an in-house error. Custom orders would be a product that you have requested a specific blend of any of the following (but not limited to): teas, coffees, packaging, labeling. If you are sent the wrong product we will correct the issue.</p> <p>Since many of our products are custom made for each client it is important that you order exactly what you are looking for. If you are in the Clayton (or surrounding areas) of NC we have all of our teas available for you to taste and smell to see what your preferences may be. This will ensure that your order is what you expected it to be.</p> <p><b>Shipping Procedures:</b><br>Being that each product is blended and packaged at the time the order is placed, there is a minimum 48 business hour turn-around time for processing and shipping (some products may take up to 2 weeks for turn-around). Some custom blends may take more than 2 weeks turn-around time as some ingredients may need to be special order. Should a custom order have longer than a 2 week turn-around time we will contact you with the option to proceed or cancel the order prior to beginning production. We make every effort to get orders processed and shipped ASAP. However, at certain times of the year (ex. holidays) delivery times may be extended due to higher demand, vacation/holiday hours (for both us and our suppliers), and longer shipping times so plan accordingly and message us for current shipping times.</p> <p>We are happy to ship to a PO Box. However, we are not responsible for packages left unclaimed at the post office.</p> <p>Due to the nature of our products we advise having someone personally accept packages. Please be sure to provide a ship-to address that generally has someone present that can accept delivery. We are not responsible for packages left outside by any mail/package carrier. Nor are we responsible for packages that are not picked up or alternate delivery arrangements made once notice is left by the carrier about an attempted delivery of a package.</p> <p>Any errors must be reported within 7 business days of receipt of the package. Please check your packages carefully when they arrive.</p> <p>We generally use USPS for all of our shipping. However, we reserve the right to use the carrier service of our choice. If a specific carrier is requested additional fees may be charged.</p> <p><strong>Disclaimer:&nbsp;</strong><br></p> <p>The statements made on this website have not been evaluated by the FDA (U.S. Food & Drug Administration). Any education, services, and/or products provided on our website, blog, in-person consultations or any social media accounts are for educational purposes only and not intended to diagnose, cure, prescribe or prevent any disease. &nbsp;Nor is any information here intended to replace the advice of your qualified health care provider.&nbsp; Some herbs may be contraindicated with certain medications and/or medical conditions.&nbsp;&nbsp;<br></p> {"tmenu_style":"H","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":"https:\/\/www.facebook.com\/SteepRightUp","vba_2_url":"https:\/\/steeprightup.com\/","vba_3_url":"https:\/\/steeprightup.com\/blog\/tea-accessory-resources\/"} Steep Right Up 4913 Lord Nelson Dr Raleigh A Steep Right Up 4913 Lord Nelson Dr Raleigh NC US 27610 TeaLady@SteepRightUp.com none Y 1628521407 0 3 acct_1CpxfEDZN9wI9Idg 179165,179173,168159,131433,134221,134225,131441,131443 Our teas are sure to tickle your tastebuds!!! https://www.facebook.com/steeprightupNC https://www.instagram.com/steeprightupnc https://www.pinterest.com/steeprightup <p>Welcome to Steep Right Up&trade;️, where it’s always time for tea.&nbsp;</p> <p>Tickle your tastebuds with one of our brews!</p> <p><br></p> <p>April/May New Teas ~ Chocolate Pu'erh, Chocolate S'more Pu'erh, & Chocolate Vanilla Mate (will be added to site on 4/16/23)</p> <p>FREE gift with every order of $50 or more!!</p> oauth.oq7P4AkLFKXP2w8r35jiK6ebHHml8q7ovqmEp9Gj.P63vcF-WwctBf1w6de46IRawSa7i13_WrrhW9ZlGaDc UA-217815683-1 SteepRightUpNC.com A N 0 0 0 0 0 S Professional Plan steep-right-up 5.0000 3221_758397