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

Query time 0.00099

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.79"
    },
    "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.84",
            "eval_cost": "0.10",
            "prefix_cost": "0.94",
            "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.75",
            "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.17",
            "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.79",
            "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
539 en <p><br></p> <p>Hello, welcome to B'cause of You, my name is Diana.&nbsp;</p> <p>Growing up in Europe, I&nbsp;had no idea that my love for the fiber arts would come from things I'd see daily. In awe, I&nbsp;would watch the women from the fishing villages along the Dutch coast knit in front of their nostalgic houses, creating the most beautiful lace shawls or sturdy fishermen's sweaters. That's when I learned that knitting while you walk is a possibility too! They would use their own patterns and share them with other women in the village or teach them to their daughters. Because of the distinct patterns, their work could easily be recognized and linked to the town it was from.</p> <p>It is no wonder that creating both art and sustainable wear go hand in hand for me. I LOVE playing with yarn and seeing how a vision turns into a creation. I&nbsp;am amazed at the versatility of yarn. Here is this thread, some knitting sticks or a crochet hook, inspiration, and voila, a functional piece of clothing.</p> <p>From picking the finest yarn to creating an heirloom from your vision, or a functional piece for everyday wear, it is my goal to make something you will love and that expresses who you are.</p> <p>Feel free to click the contact link if you have any questions.<br></p> <p>I'm here to help.<br></p> <p>"There is a solution for everything, all we have to do is find it."</p> <p>Diana, B'cause of You</p> <p><br></p> <p>Follow me on social media to catch a glimpse of new things as they come out.&nbsp;</p> <p><a href="https://www.facebook.com/CraftedBecauseOfYou" target="_blank">Facebook</a></p> <p><a href="https://www.instagram.com/bcause.of.you/" target="_blank">Instagram</a></p> <p><a href="https://www.ravelry.com/stores/diana-mcculloch-designs" target="_blank">Ravelry</a></p> <p><a href="https://www.youtube.com/channel/UCHKWdp9ZOZsm9FYpymb-b7Q?">YouTube</a></p> <p><br></p> <div class="video-container"><iframe style="width: 500px; height: 281px;" src="//www.youtube.com/embed/lzkyyUYiFak" frameborder="0" allowfullscreen="" class="ui-droppable"></iframe></div> <p><br></p> <p><b></b></p> <p><b>When does my item ship?</b><br></p> <p>The time needed to make each individual item is mentioned in the listing, please keep that in mind when ordering your item. As soon as you place your order, additional yarn (if needed) is ordered from the yarn supplier and it may take 2 weeks before that shipment gets to me. If the logistics of your order are beyond what is expected, I will keep you informed. I will ship your finished item as soon as humanly possible. If you have any questions, don't hesitate to ask!&nbsp;</p> <p><br></p> <p><strong>Ready to ship</strong> items will be prepared and go out for shipping 1-5 business days after the order has been placed.</p> <p>You will receive a shipping notification.&nbsp;</p> <p><br></p> <p>If both ready-to-ship and made-to-order items are purchased in the same transaction, all items will ship together when the made-to-order items are finished, unless otherwise requested.</p> <p><br></p> <p><strong>Shipping services: the US only</strong></p> <p>I use USPS</p> <p>- First Class Mail or</p> <p>- Priority Shipping to&nbsp;ensure you can receive tracking info.</p> <p><br></p> <p><br></p> <p><strong>Returns and exchanges:</strong></p> <p>Because of the nature of these items, unless they arrive damaged or defective, I can't accept returns for:</p> <p><i class="checkbox" name="shop[non_refundable_custom]" checked="" style="margin-top: 0px; padding: 0px; font-family: &quot;Graphik Webfont&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Droid Sans&quot;, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif; font-size: 12px; position: absolute; height: 16px; width: 16px; opacity: 0; left: 0px; top: 1px;"><span class="checkbox-label">Custom or personalized orders</span><i class="checkbox" name="shop[non_refundable_perishable]" style="margin-top: 0px; padding: 0px; font-family: &quot;Graphik Webfont&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Droid Sans&quot;, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif; font-size: 12px; position: absolute; height: 16px; width: 16px; opacity: 0; left: 0px; top: 1px;"><span class="checkbox-label">Perishable products (like food or flowers)</span><i class="checkbox" name="shop[non_refundable_digital]" checked="" style="margin-top: 0px; padding: 0px; font-family: &quot;Graphik Webfont&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Droid Sans&quot;, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif; font-size: 12px; position: absolute; height: 16px; width: 16px; opacity: 0; left: 0px; top: 1px;"><span class="checkbox-label">Digital downloads</span><i class="checkbox" name="shop[non_refundable_intimate]" checked="" style="margin-top: 0px; padding: 0px; font-family: &quot;Graphik Webfont&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Droid Sans&quot;, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif; font-size: 12px; position: absolute; height: 16px; width: 16px; opacity: 0; left: 0px; top: 1px;"><span class="checkbox-label">Intimate items (for health/hygiene reasons)</span><i class="checkbox" name="shop[non_refundable_sales]" checked="" style="margin-top: 0px; padding: 0px; font-family: &quot;Graphik Webfont&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Droid Sans&quot;, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif; font-size: 12px; position: absolute; height: 16px; width: 16px; opacity: 0; left: 0px; top: 1px;"><span class="checkbox-label">Items on sale</span><br></i></i></i></i></i>- custom or personalized items;</p> <p>- discounted or "on-sale" items;</p> <p>- digital items;</p> <p><span class="checkbox-label">- face masks (for health/hygiene reasons)</span><i class="checkbox" name="shop[non_refundable_sales]" checked="" style="margin-top: 0px; padding: 0px; font-family: &quot;Graphik Webfont&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Droid Sans&quot;, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif; font-size: 12px; position: absolute; height: 16px; width: 16px; opacity: 0; left: 0px; top: 1px;"><span class="checkbox-label">Items on sale</span></i>.<br></p> <p><br></p> <p>If the item is not as ordered or got damaged during transport, please don't hesitate to contact me as soon as possible so we can work together to solve the issue. For return processing, please notify me within 7 days of delivery through conversation. Unless added insurance claims otherwise, the item must then be returned within 7 days following the notification.</p> <p>Refunds and/or exchanges will be looked at on a case to case basis and in case you need to return your item, I will offer you a refund or store credit in the amount of the original purchase, minus shipping.</p> <p>Conditions of return:<br>The buyer is responsible for return shipping. If the item is not returned in its original condition, the buyer is responsible for any loss in value.</p> <p><br></p> <p><br></p> {"tmenu_style":"V","default_colors":"N","link_color":"#3c78d8","label_color":"#00a0af","icon_color":"#f4cccc","main_btn_color":"#ea9999","branded_text_color":"#cc0000","vbp_1_url":"","vbp_2_url":"","vbp_3_url":"","vba_1_url":"","vba_2_url":"","vba_3_url":""} B'cause of You Walla Walla A B'cause of You Walla Walla WA US 99362 Bcauseofyou2019@gmail.com none Y 1588863960 518 a:4:{s:14:"company_fields";a:2:{i:37;s:5:"Diana";i:38;s:8:"de Jager";}s:15:"admin_firstname";s:5:"Diana";s:14:"admin_lastname";s:8:"de Jager";s:6:"fields";a:0:{}} 3 acct_1GaXflL5Jjf1MX4b 416978552974888 20068,20107,20086,183379,99475,20103 UA-203725076-1 JE9G5N7JYYAEG Wearable Art https://www.facebook.com/CraftedBecauseOfYou https://www.instagram.com/bcause.of.you/ https://twitter.com/Bcause_of_You https://www.pinterest.com/BcauseofYou/ UA-203725076-1 416978552974888 A N 0 0 0 0 0 S Professional Plan bcauseofyou 539_0