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

Query time 0.00342

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.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.70",
            "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.78",
            "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
2948 en <p>Welcome to Fire Fly Lanez! I started making Resin crafts almost one year ago and Diamond Art about two years ago and I LOVE IT! I also have fallen in love with making Resin Tumblers and Snowglobe Tumblers... It's not work if you love what you do... I would LOVE to share my joy with everyone else!&nbsp;</p> <p>All Resin you see is handmade by me. Pieces are sold as is, BUT... can be customized to match your requests and/or your imagination... I use mica powder, opaque pigment, alcohol ink, glitter, shells&hellip; Items can be made into magnets, keychains and even pendants, ask and I'll see what I&nbsp;can do for you!&nbsp;Creations can be made for favors, christenings, baby showers/gender reveals, birthdays, house warming gifts, etc... <em>(If you are interested in buying items in bulk please contact me for separate pricing.)</em><br></p> <p>The Diamond Art is sold as is.</p> <p>Let’s have some fun,&nbsp;come see what I have to offer, and we can work on getting you your own creation(s).<br></p> <p class="text-center"><b><span style="color: rgb(0, 0, 0);"><em>DELIVERY OPTIONS:</em></span></b></p> <p class="text-center"><span style="color: rgb(0, 0, 0);">Local Pickup/Drop off & shipping within the US Only (fees may apply). Processing/shipping times may vary depending on the size of the order.<br><strong style="color: rgb(51, 51, 51);"><span style="color: rgb(0, 0, 0);"><em><br>CUSTOM & PERSONALIZED ORDERS:</em></span></strong><br></span></p> <p class="text-center"><span style="color: rgb(0, 0, 0);">Please make sure you include all important information when placing your order. You can enter notes / comments when checking out to make sure your order is correct. If I have to contact you, it may result in a delay of your order.<br><em><strong><br>WHAT IF YOU NEED TO RETURN AN ITEM?</strong></em><br></span></p> <p class="text-center"><span style="color: rgb(0, 0, 0);">Since all orders are custom made and personalized to your specifications, I don't accept returns. If there is a problem with the order, please reach out to me and we can discuss the next steps.<br><strong style="color: rgb(51, 51, 51);"><span style="color: rgb(0, 0, 0);"><em><br>SHIPPING INFORMATION:</em></span></strong><br></span></p> <p class="text-center"><span style="color: rgb(0, 0, 0);">I don't insure mailed packages. I do not take responsibility if packages are lost and or stolen or misplaced due to incomplete/incorrect information provided upon check out. If an error was made please contact me and I will cancel the order so you can correct the issue.<br><br></span></p> <p class="text-center"><span style="color: rgb(0, 0, 0);"><em><strong></strong><strong>CARE INSTRUCTIONS:</strong></em></span></p> <p class="text-center"><span style="color: rgb(0, 0, 0);"><em><i><b>RESIN:</b></i></em></span></p> <p class="text-center"><span style="color: rgb(0, 0, 0);">Please handle with care. Dropping your Resin art piece can result in damage. Please keep away from sunlight. Clean with a damp cloth, only if necessary.</span></p> <hr> <p class="text-center"><strong><em>DIAMOND ART:</em></strong><br></p> <p>Keeping your diamond art painting flat is the best way to store them as it will help avoid the diamonds from falling off its canvas. Store flat until you are ready to place it in a frame, or other permanent option.</p> <hr> <p class="text-center"><strong><em>DRINKWARE / CERAMIC MUGS</em><span style="color: rgb(0, 0, 0);"><i><b><em>:</em></b></i></span></strong></p> <p class="text-center"><span style="color: rgb(0, 0, 0);">Please do not place in dishwasher. Please handle your drinkware with care and hand wash with a soft non abrasive cloth. While the ceramic mug(s) can be put in the dishwasher, to preserve the beauty and longevity of the design, it is recommended (optional) they be hand washed.<br><span style="color: rgb(51, 51, 51);"><br>**</span>Please keep in mind that you have received an authentic, one of a kind, homemade art piece. Variations in texture and other imperfections may be visible.&nbsp;<span></span>I hope you love your piece as much as I&nbsp;loved making it for you!!**<em><br></em></span></p> {"tmenu_style":"V","default_colors":"N","link_color":"#0000ff","label_color":"#9900ff","icon_color":"#00a0af","main_btn_color":"#351c75","branded_text_color":"#674ea7","vbp_1_url":"","vbp_2_url":"https:\/\/fireflylanez.goimagine.com\/new\/","vbp_3_url":"https:\/\/fireflylanez.goimagine.com\/mature-items\/","vba_1_url":"","vba_2_url":"","vba_3_url":""} Fire Fly Lanez 19-30 76th street East Elmhurst A Fire Fly Lanez 19-30 76th street East Elmhurst US 11370-1295 fire.fly.lanez21@gmail.com none Y 1627318662 0 4 acct_1JHXMoIpPNrar7e7 284648,282838,282836,278049,275782,272636,269248,266306,266156,265783,266092,265784,265689,258362,258086,252518,257589,256790,256001,252277,242304,241481,239493,237409,235920,234954,234076,231091,230522,227946,224968,226497,225207,225304,225273,204337,201932,201535,197488,196621,196622,201889,192454,193258,192450,108385,144425,174144,175093,167561,167552,161993,167239,166202,165403,165290,164900,164913,161865,164905,162133,164899,160627,156319,132617,139306,120811,139394,132610,139524,131992,127555,126324,126318,126321,108204,114844,120905,108233,120730,108232,120456,108246,108180 G-8Q9FTS6YSM https://www.facebook.com/FireFlyLanez/ <p>Welcome, look around. Everything Resin can be customized to your liking! Custom Assorted Tumblers. The Diamond Art is sold as is! Have fun... Feel free to reach out with any questions.</p> oauth.VnVBHRCoDn6eHO3kgDrvXpALpQZx3MBvdFPj_8R9.wFUFetKubYluxW4UCPY8XZ4DCLePsGGD_gWyPDXHIVo G-8Q9FTS6YSM A N 0 0 0 0 0 S All-Star Plan fire-fly-lanez 2948_0