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

Query time 0.00101

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.78"
    },
    "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.86",
            "eval_cost": "0.10",
            "prefix_cost": "0.96",
            "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.68",
            "eval_cost": "0.10",
            "prefix_cost": "1.74",
            "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
319 en <p></p> <p>Welcome to Mareziedotes!&nbsp; I make handmade, kiln-fired, ceramic, essential oil diffusers!&nbsp; Drop your favorite oil or perfume on the unglazed areas of each, unique, artistic piece.&nbsp; The fragrance will last for days!&nbsp; I also make little ceramic dishes for soaps and cone incense.</p> <p><span style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">I love creating fun, colorful ceramic diffuser pendants, bracelets, earrings, stones, and dishes. I have a big collection of rubber and leather stamps and have a passion for creating with them.</span><br></p> <p><span style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">I am a happily married Mom of three great adult kids and a "Grammy" to three wonderful grandsons!&nbsp; We are avid pet lovers and care for quite the menagerie!</span></p> <p><span style="font-family: -apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, Roboto, &quot;Segoe UI&quot;, Ubuntu, &quot;Helvetica Neue&quot;, sans-serif;">&nbsp;I hope you find something that you love in my shop!&nbsp; My creations are all one of a kind, pieces of art that you can use,&nbsp; either to wear, or for your home!&nbsp; Thank you for visiting Mareziedotes!</span><br></p> <p><strong>Terms & Conditions</strong><br></p> <p><strong>RETURN & REFUND POLICY</strong></p> <p>&nbsp;I. Introduction</p> <p>Thank you for visiting and supporting my shop on Goimagine.com with your purchase. I put a lot of myself, time, energy, and love&nbsp; into the production of my products.&nbsp; I sincerely hope you are happy with your purchase.</p> <p>However, if you are not satisfied with your purchase, please contact me directly at mareziedotes@outlook.com so we may discuss why you are dissatisfied and how the situation may be rectified.&nbsp; I may need to visually inspect your purchase to determine what you may be displeased with. Purchases may be returned and refunded if any of the following apply: (a) it can reasonably be determined that the quality and/or the composition of the materials used was not as depicted; (b) it can reasonably be determined that the workmanship is not as depicted; (c) the product(s) is / are not as advertised / shown on website, (d) if the product(s) do not match the written description(s) to a reasonable degree.</p> <p><br></p> <p>II.&nbsp; &nbsp;RETURNS</p> <p>Please contact me at mareziedotes@outlook.com prior to shipping any returns. All returns must be postmarked within seven&nbsp;(7)&nbsp;days of your receipt of the product. This date will be determined by the tracking information provided by the carrier, United States Postal Service. All returned items must be clean (if you must clean prior to returning, please be sure to follow the included Care Instructions).&nbsp;</p> <p>You are responsible for return shipping costs. Your original shipping cost (if applicable) is non-refundable. You are responsible for securely packaging and returning the purchased item(s) to:&nbsp;</p> <p>Mareziedotes</p> <p>8974 Chestnut Ridge Road</p> <p>Middleport, N.Y. 14105</p> <p>I. For your records, it is advisable that you ship any products in a trackable manner.&nbsp; Please make sure you securely package the returning original item.</p> <p>II.&nbsp; REFUNDS</p> <p>After receiving your return and inspecting the condition of your item(s), I will contact you by email previously provided by you to notify you of my intention to agree or disagree to your return. Please allow at least three days from the receipt of your item to receive my emailed intention. Any refunds will be processed in the same manner as paid, i.e. credited back to the card from which the purchase was made – no exceptions. Please allow enough time for refund(s), if any, to be processed by your bank and/or credit card institution. I am not responsible for any holds those entities may place on your funds.</p> <p>III.&nbsp; EXCEPTIONS</p> <p>&nbsp;For defective or damaged products not caused by shipping, please contact me by email to mareziedotes@outlook.com to arrange an exchange or possible refund.</p> <p>IV. QUESTIONS</p> <p>&nbsp;If you have any questions concerning my return policy, please contact me at: mareziedotes@outlook.com</p> <p>&nbsp;</p> <p><strong>SHIPPING POLICY</strong></p> <p>I. Thank you for your purchase.&nbsp; I put lots of time and energy into the production of your purchase and I hope you are happy with your purchase. It is my intent to ensure you receive your purchase in as timely a manner as I possibly can.</p> <p>Shipper and Shipping Fees:&nbsp;&nbsp;</p> <p>Products are shipped by and through United States Postal Service (“USPS).&nbsp; Unless otherwise noted, only <b>First Class</b>&nbsp;is available through my store.&nbsp; You will be advised at checkout of all shipping fees.&nbsp;&nbsp;</p> <p>II.&nbsp; &nbsp;Delivery Times and Tracking Numbers: </p> <p>Please allow up to three (3) business days for me to deliver your package to the postal service.&nbsp; I realize that you may be excited to receive your package, and I am just as excited to send it to you.&nbsp; However, in case of inclement weather, I do need to make arrangements to get to the post office (or other shipping facility) in a safe and timely manner.</p> <p>USPS takes approximately 3-5 days to deliver.&nbsp; If possible, please have your purchases delivered to an address where someone will be available, and responsible, for taking delivery.&nbsp; I am not, and will not be, responsible for packages stolen from your doorstep, lobby, garage, porch, patio, etc. once delivery has been made by the postal service.&nbsp; Please notify your local post office and, if appropriate, your local police force, should your package be stolen after delivery.&nbsp; Packages will be deemed to be properly delivered if:&nbsp; a) the delivery address given at time of purchase, by you, is correct; and (b) the tracking number shows successful delivery to that address.&nbsp; I am not responsible for packages lost, misplaced, or mis-directed by USPS.&nbsp; Please contact your local postal facility in cases of lost packages.</p> <p>In extreme weather, such as hurricanes and/or tornadoes, please be advised that package delivery times may be affected.&nbsp; Such weather may also impact how quickly I can deliver your package to the postal facility.&nbsp; I will attempt to keep you advised of any possible delays due to inclement weather and request your understanding and patience.&nbsp; Thank you!</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":""} Mareziedotes 8974 Chestnut Ridge Rd Middleport A Mareziedotes 8974 Chestnut Ridge Rd Middleport NY US 14105 mareziedotes@outlook.com none Y 1586653323 0 a:4:{s:14:"company_fields";a:2:{i:37;s:4:"Mary";i:38;s:10:"Dauphinais";}s:15:"admin_firstname";s:4:"Mary";s:14:"admin_lastname";s:10:"Dauphinais";s:6:"fields";a:0:{}} 3 acct_1GXbghFV98IR5gjx 11580,11822,15446,22641,23452,24293 36269W64DHAVS A N 0 0 0 0 0 S Professional Plan mareziedotes 5.0000 319_517