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

Query time 0.00118

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.80"
    },
    "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.71",
            "eval_cost": "0.10",
            "prefix_cost": "1.76",
            "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.19",
            "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.80",
            "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
3195 en <p>My 80 lb "critter chaser" is the highlight of my shop! Rowan supervises me while I work and together we test all the products to make sure that you have equipment that you can rely on so that you can enjoy your adventures worry-free and hands-free!</p> <p><span style="color: rgb(34, 34, 34); font-weight: 700;">Processing Times</span></p> <p>Processing Time will vary based on the product. Please see the information in the description of each product or reach out to me if you want to clarify my processing time on anything custom.</p> <p><span style="color: rgb(34, 34, 34); font-weight: 700;">I accept returns, exchanges, and cancellations</span></p> <p>Contact me within: 10 days of delivery<br>Ship items back within: 14 days of delivery<br>Request a cancellation within: 2 hours of purchase for standard items.</p> <p><strong>The following items cannot be returned or exchanged</strong></p> <p>Because of the nature of these items, unless they arrive damaged or defective, I can't accept returns for:</p> <ul><li>Custom orders</li><li>Items on sale</li></ul> <p><strong>Conditions of return</strong></p> <p>Buyers are responsible for return shipping costs. If the item is not returned in its original condition, the buyer is responsible for any loss in value.</p> <p><strong>Damaged Package?</strong></p> <p>Please document any package damage prior to opening your delivery, multiple photos including at least one showing the shipping label clearly will help me make a claim to USPS for damages. Please also take multiple photos of your product and clear images of any damage that it has sustained.&nbsp;</p> <p><b>Shipping Time Estimates</b></p> <p>Estimated shipping time frame does not typically include any extension for USPS delays that are in effect due to staffing shortages or weather related delays. If you need a product by a specific date please reach out prior to ordering and see what my current shipping and delivery times are to your region.</p> <p><span style="color: rgb(192, 80, 77);"></span><i style="font-weight: 700;"><span style="color: rgb(192, 80, 77);">Where's My Package?</span></i></p> <p>If your tracking says "Delivered" but it's not in your mailbox?</p> <p>USPS frequently scans packages and marks them "delivered" up to 24 hours prior to physical delivery. Please be patient and remember that this is not within my control!</p> <p>Please read the USPS help for information on delivery and finding your packages:&nbsp;<a href="https://faq.usps.com/s/article/Where-is-my-package">https://faq.usps.com/s/article...</a></p> <p>Consider signing up for USPS "informed delivery" to get up to date notices!</p> <p><b>Care Instructions</b></p> <p>Webbing Leashes: Hand wash in cool water with gentle dishwashing liquid, or Machine wash in leash wash bag or knotted pillow case, delicate cycle, cold. Hang to dry. </p> <p>Paracord Leashes: Hand wash in cool water with gentle dishwashing liquid, or Machine wash in leash wash bag or knotted pillow case, delicate cycle, cold. Hang to dry.</p> <p><strong>Custom Items</strong></p> <p>I can do customization on the majority of my existing leash products, please reach out with questions prior to ordering.<br><br>There will be an additional charge for a webbing or paracord color that I do not currently offer. I cannot guarantee color matching with your existing equipment but will do my best to find the closest option that I have available or that I&nbsp;can find with my suppliers.<br><br>If you do not see a product in my shop and are interested in something completely custom, please send me a message with as much detail as possible and I will let you know what I can do for you.<br><br>I do not offer personalization (i.e. pet names) on products at this time.</p> <p><strong>Sizing Details</strong></p> <p>Braided Paracord Leashes and Long Lines do have some initial stretch. I make them as close to the stated lengths as possible, but you can expect them to get slightly longer as they are used. If you need an exact finished measurement please reach out to discuss options prior to ordering</p> <p>Webbing Leashes are measured "clip-end to clip-end" or "clip-end to leash-end" unless stated otherwise. I do my best to get as close to the stated length as possible but will err on the side of longer rather than shorter.</p> <p>Leash Couplers are measured "clip to center of O-Ring"</p> <p><strong>Quantity/Bulk/Wholesale Orders</strong></p> <p>Please reach out if interested in purchasing 10 or more of any one item.&nbsp;</p> <p><br></p> <p><br></p> <h6></h6> <p><br></p> {"tmenu_style":"H","default_colors":"Y","link_color":"#351C87","label_color":"#7611CC","icon_color":"#D83C8F","main_btn_color":"#EB6D6D","branded_text_color":"#B0CC11","vbp_1_url":"nomnom.jpeg","vbp_2_url":"nomnom1.jpeg","vbp_3_url":"nomnom4.jpeg","vba_1_url":"https://greenmountainmutts.goimagine.com/hands-free-leash-system/","vba_2_url":"https://greenmountainmutts.goimagine.com/hands-free-leash-system/hands-free-leashes/","vba_3_url":"https://greenmountainmutts.goimagine.com/hands-free-leash-system/hiking-leashes/"} Green Mountain Mutts1 13519 W Dakota Pl Lakewood A Green Mountain Mutts1 13519 W Dakota Pl Lakewood CO US 80228 wendy.harmening@gmail.com none Y 1628366026 0 3 acct_1JMcXHBM6j8wK4Iu 205977,156538,170354 G-1N38XZB102 3KSCLV9CG6SG2 Walk, Run and Hike with your Dog - Hands Free! https://www.facebook.com/greenmountainmutts https://www.instagram.com/green.mountain.mutts/ <p>Welcome to my Shop!</p> <p>I love to walk, run and hike with my dog, and offer a hands-free system & accessories so you can get the most out of all the activities you do with your own dog!</p> UA-204442960-2 mountainmutt1.come4 A N 0 0 0 0 0 S Professional Plan green-mountain-mutts 3195_0