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

Query time 0.00116

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "3.06"
    },
    "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.87",
            "eval_cost": "0.10",
            "prefix_cost": "0.97",
            "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.73",
            "eval_cost": "0.10",
            "prefix_cost": "1.80",
            "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.23",
            "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.66",
            "eval_cost": "0.18",
            "prefix_cost": "3.06",
            "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
69 en <p></p> <p>Hello, and welcome to our shop of unique ear cuffs, unusual ear wraps, and special and different earrings, rings, pendants, all made in America, one at a time, by us in our northern California studio.</p> <p>We've been making jewelry since 1975, other than the years we spent owning a wonderful American craft gallery and selling other people's artwork. <br><br>Inspired by the beauty of our natural surroundings here on the wild northern California coast, we take our cue from natural shapes and natural materials. <br><br>Both of us, Ed and Sandy, (husband and wife for {gasp!} 45+ years) design and fabricate the jewelry pieces, and we work on a design until it makes us smile....because then we know it will make you smile.<br><br></p> <p>We live in a tiny village at the southern end of Mendocino county, about a hundred miles (as the crow flies...not by the winding roads) north of San Francisco. We feel so blessed to step out under the redwood trees or look out to see the Pacific Ocean stretched out to the horizon. Quiet (except when the sea lions are barking down on the beach) and peaceful, this is an amazing place to live.</p> <p> </p> <p><br></p> <p>All of our jewelry is created, one at a time, by hand. &nbsp; If a piece is marked OOAK (One of a Kind), you will receive the piece pictured on the listing. &nbsp; Otherwise, you will receive a piece of the same quality as shown and as similar as can be made by human hand but with very slight differences due to the handcrafted nature. <br><br>That's the beauty of handmade...each one is truly an original.<br><br>Thanks for your interest in our jewelry. &nbsp; Please send us an email if you have any questions.</p> <p></p> <p></p> <p>Hello, and welcome to our shop... Sunny Skies Studio, your place for Fun & Fancy Handmade Jewelry Artwear...</p> <p>Unique Ear Cuffs & Ear Wraps; Unusual Earrings and Ear Sweeps; Beautiful Bracelets, Rings & Stack Rings, and Pendants.<br><br></p> <p>Unique jewelry...unique like you.&nbsp; All handcrafted by us on the beautiful, wild northern California coast.<br><br></p> <p>We accept payments through the Stripe payment system.<br><strong></strong><br></p> <p><strong><span style="color: rgb(192, 80, 77);">&nbsp;SHIPPING SCHEDULE:</span></strong><br><strong>Our current mailing date is 5 business days after receipt of your order</strong>...sooner, if at all possible.<br>Pieces ordered on a weekend will <strong>ship on the Monday after the 5 business&nbsp; day mail date</strong> (because the post office is not open on weekends here).<br></p> <p><br></p> <p>If you need a piece of jewelry shipped more quickly,&nbsp; <strong>PLEASE email us BEFORE purchase </strong>to see if that will be possible.&nbsp;&nbsp; If we can do so, we will be happy to ship earlier,&nbsp; but sometimes circumstances in life prevent that from happening.<br><br></p> <p>Shipments to US addresses are sent insured first class mail with USPS tracking.</p> <p><strong>PLEASE DOUBLE-CHECK the shipping address</strong> on your order to make sure it is the correct one.</p> <p><strong>Time in transit through the postal system</strong> after that will vary with location,&nbsp; with most DOMESTIC US PACKAGES arriving in 2-7 business days</p> <h6><span style="color: rgb(192, 80, 77);">RETURNS, EXCHANGES AND CANCELLATIONS:</span></h6> <h6>I gladly accept returns, exchanges, and cancellations&nbsp;</h6> <h6>Contact me within: <span class="text-gray-darker">5 days of delivery</span>&nbsp;</h6> <h6>Ship items back within: <span class="text-gray-darker">7 days of delivery</span>&nbsp;</h6> <h6>Request a cancellation within: <span class="text-gray-darker">12 hours of purchase</span> </h6> <h6>The following items can't be returned or exchanged.&nbsp; Because of the nature of these items, unless they arrive damaged or defective, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; I can't accept returns for: </h6> <p></p> <ul> <li>Custom or personalized orders</li> <li>Perishable products (like food or flowers)</li> <li>Digital downloads</li> <li>Intimate items (for health/hygiene reasons)</li></ul> <p></p> <h6><span style="color: rgb(192, 80, 77);">RETURN AND EXCHANGE DETAILS:</span></h6> <p> All pieces are carefully wrapped for shipping and are insured against loss or damage. If you receive a piece that has somehow been damaged in the mail, please save your packaging materials for inspection in order to make a damage claim and contact us immediately.</p> <p>We love creating our jewelry, and we want you to love owning it.<br>If you are unhappy with your purchase, please contact us<strong> within 5 days of receiving your order</strong> so that we can arrange a refund or exchange. Unfortunately, original shipping charges are non-refundable.</p> <p><br></p> <p><strong><span style="color: rgb(192, 80, 77);">Questions about your order?</span></strong> Please&nbsp;<b class="btn btn-link" style="background-color: transparent; border-bottom-color: currentColor; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-bottom-style: none; border-bottom-width: medium; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: currentColor; border-left-style: none; border-left-width: medium; border-right-color: currentColor; border-right-style: none; border-right-width: medium; border-top-color: currentColor; border-top-left-radius: 3px; border-top-right-radius: 3px; border-top-style: none; border-top-width: medium; box-sizing: border-box; color: rgb(34, 34, 34); display: inline-block; font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: center; text-decoration: underline; text-transform: none; -webkit-appearance: none; -webkit-tap-highlight-color: transparent; white-space: nowrap;" data-action="open-convo"> contact me if you have any problems with your order.<br></b></p> <p><br></p> <p><br></p> <p></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":""} Sunny Skies Studio 35501 S. Highway 1 #96 Gualala A Sunny Skies Studio 35501 S. Highway 1 #96 Gualala CA US 95445 sandesmith@earthlink.net none Y 1584487409 0 a:4:{s:14:"company_fields";a:2:{i:37;s:5:"Sandy";i:38;s:5:"Smith";}s:15:"admin_firstname";s:5:"Sandy";s:14:"admin_lastname";s:5:"Smith";s:6:"fields";a:0:{}} 3 acct_1GPFgdDSuK3JlQps A {"items_per_file":"2500","time_from":"","time_to":""} N 0 0 0 0 0 S Professional Plan sunnyskiesstudio 5.0000 69_613