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

Query time 0.00453

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "3.87"
    },
    "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.92",
            "eval_cost": "0.10",
            "prefix_cost": "1.02",
            "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.83",
            "eval_cost": "0.10",
            "prefix_cost": "1.96",
            "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.38",
            "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": "1.32",
            "eval_cost": "0.18",
            "prefix_cost": "3.88",
            "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
8205 en <p>GOUVEIAhome sells products handcrafted by members of the Gouveia family of Massachusetts.</p> <p>Quick Family History:<br>In 1912 at the age of 4, Joseph Gouveia travelled with his parents to the US from Funchal, Madeira (Portugal). In 1933 Joseph and his wife Clara had a son, Robert (Bob) aka "Papa". Bob married&nbsp;Blanche and together had&nbsp;4 daughters. Lauren, Leslie, Linda and Jacquie. Known as the Gouveia girls.</p> <p>GOUVIEAhome consists of 3 main artisans. They are Lauren's daughter, Marissa Marvel; Linda's daughter, Sara Paulson and Jacquie Gouveia.</p> <p>Behind the scenes crafts people include Bob Gouveia, Leslie Gouveia and Linda "Gouveia" Paulson<br></p> <p>Artisans:</p> <p>Marissa Marvel is a school nurse during the day and obtained her Nurse Practitioner's license in 2021. When she's not tending to children, she's a master at working with resin and creates a variety of items such as cutting boards, coasters and wood cut-outs. Her work is available in various shops throughout Cape Cod including Martha's Vineyard. She also runs her own store called&nbsp;<a href="https://www.wildcanvasdesign.com/" target="_blank" title="Wild Canvas Design" rel="noopener noreferrer">Wild Canvas Design.</a></p> <p>Although Sara Paulson is the youngest on the team, she is by far the oldest soul. She is GOUVEIAhome's&nbsp;jack-of-all trades with a skill set that includes painting, sewing, baking, making frames and macrame. She has a love for items that create a sense of nostalgia and that remind her of the beach.</p> <p>Jacquie Gouveia has a degree in Accounting and worked in the corporate world as a financial systems analyst for many, many years. She has made art since as far back as she can remember and over the years improved her painting skills. Her art is collected internationally along with being used on television shows such as Netflix - House of Cards, HGTV and the Foodnetwork - Cooking with Valerie. Her portfolio site can be viewed at&nbsp;<a href="https://www.jgouveia.com/" title="Jacquie Gouveia Art Portfolio" target="_blank" rel="noopener noreferrer">www.jgouveia.com</a></p> <p>Crafts People:</p> <p>Bob Gouveia owned and operated a landscaping nursery for years before retiring. He has always had a passion for woodworking and has made furniture for all the members of the family. At 87 his granddaughters keep him busy with requests for handmade items such as cutting boards that he creates from old cut down trees.&nbsp;</p> <p>Leslie Gouveia is a graduate of IYRS &nbsp;(International Yacht Restoration School) in Newport, RI. She is a master boat builder at Arey's Pond in Orleans, MA and provides wood cutouts, wood scraps and cut pieces needed by the artisans.</p> <p>Linda "Gouveia" Paulson works with her daughter Sara to create the popular all natural soy candles. Together from their kitchen in Freetown, MA, they come up with new fragrances and jar design ideas.</p> <p><br></p> <p><br></p> <p><b><u>PAYMENT</u></b></p> <ul><li>Goimagine and GOUVEIAhome accepts all major credit cards and the platform uses Stripe to process payments.&nbsp;</li><li>Stripe keeps your payment information confidential and secure, and we never receive your credit card information.</li><li>Orders will be processed in 3-5 business days once payment has cleared.</li></ul> <p><b><u>SHIPPING</u></b><br></p> <ul><li>Most packages are shipped via First Class: 3-5 days or Priority Mail: 1-3 days and includes tracking number and standard insurance. Larger items will be shipped via UPS or FedEx ground.</li><li>We offer Free US shipping in the lower 48 states</li><li>We have no control over the scans, delays/deliveries from the USPS.</li><li>If your package says delivered, we are not responsible for lost, stolen, or damaged packages. Please contact the USPS or your local law enforcement agency for further assistance depending upon the circumstances.</li></ul> <p><br></p> <p><b><u>REFUNDS AND EXCHANGES</u></b></p> <ul><li>NO RETURNS, NO EXCHANGES and NO REFUNDS on jewelry items for hygienic purposes, NO EXCEPTIONS.&nbsp;</li><li>NO RETURNS, NO EXCHANGES and NO REFUNDS on custom personalized items, NO EXCEPTIONS.</li><li>Please contact me within 7 days of delivery if you have an issue with your order.</li><li>Please read all of the details of the item you wish to purchase to verity size, color, material etc. before purchasing.</li><li>Returns must be sent back within 14 days of DELIVERY in perfect condition. The buyer is responsible for the return shipping cost and must provide GOUVEIAhome with a tracking number. If the item is returned in perfect condition, a refund will be processed.</li><li>Buyers are responsible for the return shipping costs.&nbsp;</li><li>If the item is not returned in its original condition, the buyer is responsible for any loss in value.&nbsp;</li><li>Cancellation can be requested within 4 hours of purchase.&nbsp;</li><li>GOUVEIAhome reserves the right to cancel any order without explanation at any given time.&nbsp;</li></ul> <p><b><u>COPYRIGHT</u></b></p> <ul><li>Our artists retain the full copyrights to any and all paintings they have created.</li></ul> {"tmenu_style":"V","default_colors":"N","link_color":"#007d89","label_color":"#007377","icon_color":"#007377","main_btn_color":"#6dd1d6","branded_text_color":"#007377","vbp_1_url":"","vbp_2_url":"","vbp_3_url":"","vba_1_url":"","vba_2_url":"","vba_3_url":""} GOUVEIAhome 154 Sabin Street Belchertown A GOUVEIAhome 154 Sabin Street Belchertown MA US 01007 jacquie@gouveiahome.com +15087282781 none Y 1668874813 0 2 acct_1M6ajjEjSbHR77s5 S5JPZEZ3BQGWC https://www.facebook.com/jgouveia.painter/ https://www.instagram.com/gouveiahome/ https://www.pinterest.com/jgouveia/ A N 0 0 0 0 0 S Growth Plan gouveiahome 8205_0