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

Query time 0.00284

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.84"
    },
    "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.88",
            "eval_cost": "0.10",
            "prefix_cost": "0.98",
            "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.44",
            "eval_cost": "0.18",
            "prefix_cost": "2.84",
            "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
2730 en <p>Hello!&nbsp; My name is Melissa and I am a stay at home Mom to three wonderful children. I started my Baby WhatKnots business in 2010 and I&nbsp;truly enjoy what I do.&nbsp;&nbsp;God has blessed me with an amazing husband and three wonderful&nbsp; children. I would love to share with you how I started my business and how God has led me right where I&nbsp;need to be.&nbsp;</p> <p>A Blessing in Disguise<br></p> <p>In 2009, during the economic downturn, I was laid off from my job. At the time, my husband and I were expecting our first child and I was 8 months pregnant. The plan had always been for me to be a working mom; day care, car pool, the whole thing. After I lost my job, I quickly scrambled to return things back to normal. I remember taking my big old belly on several interviews and never receiving a call back.</p> <p><span class="mt-xs-1" data-inplace-editable-text="story" data-endpoint="AboutPost" data-key="story" data-placeholder="How did you get started? What inspires you? We know each seller’s story is unique&mdash;tell yours here.">My daughter was born several weeks later and it didn't take long for me to realize that I wanted to stay home with her. I just couldn’t imagine having to go back to work. After she was born, I started to make her accessories. It started with burp cloths and blankets and then moved on to pacifier clips and hair bows. It was something that I enjoyed doing and it wasn’t long before I had friends and family requesting items from me.<br><br>In 2010 I opened my first online store and started selling my creations. Several years ago, I came across the concept of the Jesse Tree. I started to make and sell sets in my shop and local community and my business has now grown to selling hundreds of sets a year. I am so grateful that God has blessed me in so many ways and given me this opportunity to spread the Gospel.<br><br>I look back now and know that God had a plan for me all along. I felt so scared and defeated the day that I lost my job. I was so confused about what God was doing but I’ve learned now that even when things don't make sense, I need to trust Him.&nbsp;</span></p> <p>"For I know the plans I have for you,” declares the Lord, “plans to prosper you and not to harm you, plans to give you hope and a future." Jeremiah 29:11<br></p> <p><br></p> <p><em></em></p> <p><b></b><span style="color: rgb(34, 34, 34); font-size: 18px; font-weight: 700;">PROCESSING TIMES:</span></p> <p><b></b>Each of our items are handmade to order.&nbsp; Please allow 3-5 business days for processing.</p> <h5></h5><h5>SHIPPING TIMES:</h5> <p>USPS First Class Mail service is 3-5 days (excludes Sunday) USPS Priority Mail service is 1-3 days (excludes Sunday) USPS Priority Express Mail service is an overnight shipping service but some locations require 2 days Delivery times are provided by the United States Postal Service, however, occasionally packages can be delayed. If you have a specific "need by" date, we highly recommend that you purchase the Priority Express Mail Service, as this is the only guaranteed service. </p> <h5></h5><h5>RETURN POLICY:</h5> <p><b>If you need to return your order for any reason, simply contact us within 7 days of order being marked delivered by USPS. Personalized items where you have selected a name or hair color, etc. are not eligible for return. Returned items must be in original condition, buyer is responsible for any loss in value if an item isn't returned in original condition. Please be sure to package returned items in a way that they will not be damaged in transit, this is especially important for our Jesse Tree ornaments. Buyer is responsible for return shipping and must provide a tracking number. Refund will be applied once we receive items back in original condition. ***Jesse Tree Ornament Sets, Jesse Tree Advent Cards, Jesse Tree Wooden Display Trees and Jesse Tree Advent Pocket Calendars purchased after December 15th, will have a 10% restocking fee.</b></p> <h5></h5><h5>CANCELATION POLICY:</h5> <p>Cancelation requests must be received within 24 hours of purchase</p> <h5></h5><h5>PAYMENT:</h5> <p>We accept payments via Paypal</p> <h5></h5><h5>FAQs:</h5> <p>Q: What is our current processing time? A: Each of our items are handmade to order. Please allow 3-5 business days for processing unless indicated otherwise on the items page. Q: Do we offer free shipping? A: We currently offer free domestic shipping on orders of $35 or more. Q: Do we have any coupon codes? A: Yes, we do offer coupon codes several times throughout the year. Coupons are good on regular priced items only. Coupons must be entered at the time of the order. One coupon may be used per order. Coupons are not valid on wholesale or custom orders. If you received a coupon code from us with your order, it can only be used on our website, babywhatknots.com. for information about sales and coupons, you can like us on Facebook, www.facebook.com/babywhatknots, or follow us on Instagram @baby.whatknots. Q: What are our business hours? When can we be reached? A: Our standard business hours are Monday - Friday from 6:00 am CST until 4:00 pm CST. If you contact us, we usually will respond with 24 hours. Please see our Shop Announcement section for updates regarding changes to our normal hours as they do vary occasionally especially around major holidays. Q: Do we accommodate custom orders? A: Yes, we do take custom orders. Please note, custom items cannot be returned. Please contact us so we may discuss the details. Q: Do we offer wholesale pricing? A: Yes, we do offer wholesale pricing on select items. Please contact us so we may assist you. Q: Do we offer a RUSH order option? A: We do not charge a fee for RUSH orders. If you need something quickly please contact us so we may assist you. Also, you always have the option to upgrade your shipping speed during checkout.</p> <p><em></em></p> {"tmenu_style":"V","default_colors":"Y","link_color":"#007d89","label_color":"#00a0af","icon_color":"#00a0af","main_btn_color":"#6dd1d6","branded_text_color":"#00a0af","vbp_1_url":"babywhatknots.com","vbp_2_url":"https:\/\/babywhatknots.goimagine.com\/jesse-tree-ornaments-biblical-advent-ornaments\/","vbp_3_url":"https:\/\/babywhatknots.goimagine.com\/jesse-tree-ornaments-biblical-advent-ornaments\/","vba_1_url":"https:\/\/babywhatknots.goimagine.com\/holidays\/christmas\/wood-childrens-jesse-tree-ornaments-corresponds-with-the-jesus-storybook-bible-book-not-included\/","vba_2_url":"https:\/\/babywhatknots.goimagine.com\/holidays\/christmas\/childrens-jesse-tree-advent-cards-corresponds-with-the-jesus-storybook-bible-clone\/","vba_3_url":"https:\/\/babywhatknots.goimagine.com\/holidays\/christmas\/wood-childrens-jesse-tree-ornaments-corresponds-with-the-jesus-storybook-bible-book-not-included\/"} Baby Whatknots 437 E 458 N Valparaiso A Baby Whatknots 437 E 458 N Valparaiso IN US 46383 babywhatknots@yahoo.com none Y 1626011519 0 4 acct_1JGQs4EQrKzT27M9 288005,288012,288011,288564 G-Q3LQJCRSHM 8AHUYTHRQC9VL Why Knot Have Some Fun www.facebook.com/babywhatknots instagram.com/baby.whatknots/ https://www.pinterest.com/babywhatknots <p class="text-center">Welcome! Please enjoy<strong> FREE SHIPPING</strong> on all US orders over $35.</p> oauth.B_01OIZt3WyTbjdq1K2VuFituy6lC3GdRTML8AKR.gzk1JZn79O1WUr4VTVFqXc4cvf_1MLRiyqZXGUKNRoQ G-Q3LQJCRSHM A {"items_per_file":"2500","time_from":"","time_to":""} N 0 0 0 0 0 S All-Star Plan babywhatknots 5.0000 2730_705788