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

Query time 0.00098

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.72"
    },
    "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.83",
            "eval_cost": "0.10",
            "prefix_cost": "0.93",
            "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.64",
            "eval_cost": "0.10",
            "prefix_cost": "1.68",
            "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.10",
            "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.72",
            "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
2862 en <p>Welcome to SewFancybyJulie.&nbsp; I live in a small town in South Dakota, and have lived, with my husband for 25 years.&nbsp; After his discharge from the Air Force in 1975, we returned to our home state of Michigan.&nbsp; How did I get to South Dakota, he took a job transfer and here I&nbsp; am and loving it.</p> <p>I have always sewn my own clothing, as well as, for my children and grandchildren.&nbsp; After retiring, I discovered machine embroidery.&nbsp; I love every minute of what I do.&nbsp; I do it to offer prospective buyers options they can't find in the big box stores.<br></p> <p>I do items for the kitchen, pot holders, table runners, embroidered kitchen towels, and so much more.&nbsp; I am a one woman show.&nbsp; I do all the product making, product listing and mailing myself.&nbsp; It's a lot of work, but you never work a day in your life if you love what you do.&nbsp; I love what I do.</p> <p>Please come by and take a look around, my shop is small for now and I plan on expanding my shop as time goes by.</p> <p>If you have any questions or requests, please feel free to contact me and I'll see if I can help you. <br></p> <p>Thank you, <br></p> <p>Julie<br></p> <p><br><br><br><br></p> <p>I charge a bit higher price for custom orders.&nbsp; Contact me and we will discuss what you want on the order.&nbsp; I do send pictures for your approval.&nbsp; Once approved, I will set of a custom listing and the order must be paid in full before I start your order.&nbsp; Please understand customization takes a little long to work with and get your order the way you want it.&nbsp;</p><p><br></p><p>SHIPPING:&nbsp; My shipping time is 3-4&nbsp; business days, excluding weekends and holidays.&nbsp; This gives me time to get your order ready for shipping.&nbsp; I do my best to meet this schedule, and most times ship earlier.&nbsp; I ship USPS first class with tracking unless specified differently or you choose to use USPS Priority Mail.&nbsp; I have no control over packages once they are in the possession of shipping carrier.&nbsp; At this time, I only ship to the United States.<br></p> <p>All sales are final.&nbsp; I do not accept return, exchanges, or cancellations.&nbsp; If there is a problem with your order, please contact me, so we can discuss the problem and come to an amicable solution.&nbsp; Please do not just return an item without contacting me, as there will not be any kind of refund.&nbsp; This also applies to packages marked "Return to Sender."&nbsp;&nbsp; If a refund is necessary, buyer will pay return shipping.&nbsp; Pictures will be required if there is damage and original packaging returned.&nbsp; I take a video of items as they go into the package before I ship.&nbsp; Not responsible for lost packages, you can add insurance to your order.</p> <p>Due to different light setting the actual color may vary a bit from the pictures.&nbsp; I try to take accurate pictures, but some colors do not photograph well.&nbsp; I will note that in the descriptions, where necessary.&nbsp; You may always ask questions.&nbsp; <br></p> <p><strong>MESSAGES:&nbsp; </strong>I try to answer my messages withing a few hours.&nbsp; Depending on your time zone, it may not be until the next morning.&nbsp; Usually very early, I'm an early riser.<br></p> <p><br></p> <p><br></p> {"tmenu_style":"V","default_colors":"N","link_color":"#007d89","label_color":"#00a0af","icon_color":"#ffffff","main_btn_color":"#0b5394","branded_text_color":"#ffffff","vbp_1_url":"sewfancybyjulie.com","vbp_2_url":"","vbp_3_url":"","vba_1_url":"","vba_2_url":"","vba_3_url":""} SewFancybyJulie 30966 416TH AVE Springfield A SewFancybyJulie 30966 416TH AVE Springfield SD US 57062 jwalker88forever@yahoo.com none Y 1626728440 0 3 acct_1Cdhs8CjOEjIlt3w 1029130174595751 287897,287918,117640,171149,215062,215004,205078,205164,199101,170795,171144,171208,170437,171219 6V9BMRRP6YF3S Sewing and Machine Embroidery for the kitchen and more. Something for everyone. https://facebook.com/SewfancybyJulie-110671420648792 https://www.instagram.com/julie.walker.94/ https://www.pinterest.com/SewFancybyJulie <p>Welcome to my shop.&nbsp; Take a look around, there is something for everyone.&nbsp; Gifts for everyone from my home to yours. Thanks for stopping by.<br></p> oauth.A5cJh4gIcWHVsKJLqskdtNK-SzbKArJ6_hPpL4Fi.qcfXrFdtPV-vc8cFr6Cu7UoerrwVvPUT7iZ8C6kM8xY UA-205136000-2 1029130174595751 sewfancybyjulie.com A {"items_per_file":"2500","time_from":"","time_to":""} N 0 0 0 0 0 S Professional Plan sewfancybyjulie 5.0000 2862_738073