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

Query time 0.00096

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "3.03"
    },
    "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.87",
            "eval_cost": "0.10",
            "prefix_cost": "0.97",
            "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.77",
            "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.20",
            "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.66",
            "eval_cost": "0.18",
            "prefix_cost": "3.03",
            "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
264 en <p>Hello, my name is Amanda, I am a housewife, a cat lover and Maker of many things. It seems like I have always been crafting something. I learned to sew, crochet, and embroider from my grandmothers when I was young and that was just the beginning of my love of making things. I have gone through phases in my life where I have crafted many things, it seems like almost everything. I love embroidery, cross-stitch, and floral arranging but I have also made Christmas wreaths, scrapbooks, and leather crafts.<br></p> <p><br>I started making chainmaille jewelry around 2012. It didn't take long for "playing with rings" to become an addiction. As I learned more chain patterns, I also learned to use better quality rings and materials. I still love light-weight, small silver- and gold-plated rings, but I also use a variety of anodized aluminum of various gauges and sizes. I am careful to make sure that all my rings are made with nickel-free materials, but occasionally some clasps and charms are not guaranteed nickel-free. I know lots of people have metal sensitives and allergies and I promise to clearly mark all of my products, so that you will always know what you are getting.<br><br>Part of why my chainmaille is priced higher than some others is because of the number of hours I spend on each piece. I probably could make things faster, but they would not be the quality I expect of myself. I am a bit O.C.D. so I tend to obsess over my ring closures. I know it's not possible to close every single ring perfectly, but I try.&nbsp; I aim for tight fits with good alignment not only side to side but top to bottom. In general, if I can see space/light then it's not right and I will do it again. I believe that gaps and misalignment lead to snagging and snagging leads to damage and breakage, so I work very hard to avoid that.&nbsp;&nbsp;</p> <p>In recent years I&nbsp;have also started to make art in various other forms and mediums, from wire tree sculptures to paintings on canvas and the occasional combination.&nbsp;</p> <p>Welcome to RainbowMaille, I try to use only nickel-free and hypoallergenic materials in my jewelry, if I ever use anything that is not nickel-free the listing will specify that.&nbsp; The wall art is not made with nickel- free materials because it is not meant to be worn.</p> <p><br></p> <ul><li><strong><span style="color: rgb(149, 55, 52);">Returns and Cancellations</span></strong></li></ul> <p>Returns are accepted within 14 days of delivery, money will be refunded after the product is returned. Return shipping costs are the responsibility of the buyer.<br><br>If an item is broken or damaged in shipping I will repair or replace it at no charge, please message me to make arrangements.&nbsp; &nbsp; 4rainbowmaille@gmail.com<br><br>Cancellations are accepted before orders ship but be warned I ship quickly often same day on completed items.<br>Cancellations requested after the 24-hour period will be decided on a case by case basis and may not be eligible for full refund if the order has already shipped.</p> <p><br></p> <ul><li><strong><span style="color: rgb(155, 187, 89);"><span style="color: rgb(149, 55, 52);">Shipping</span></span><span style="color: rgb(149, 55, 52);"></span></strong></li></ul> <p>Once payment has been received/processed I will ship the order, most orders will ship within 1-3 days.<br>*You have a choice of shipping via USPS Priority mail or First-class package on most items, tracking is included.<br><br>Custom orders may take longer to ship depending on the size of the item.<br><br>*Please make sure to provide a correct/current address. I am not responsible for misdirected packages due to incorrect address information provided by the buyer.</p> <p><br></p> <ul><li><strong><span style="color: rgb(149, 55, 52);">Custom orders and wholesale</span></strong></li></ul> <p>I will happily do custom orders for chainmaille jewelry or wire tree art, just contact me and tell me what you want. There is no design fee for custom work. However, if it requires the purchase of special materials there may be a variance from standard pricing.<br><br>I will not do wholesale due to the number of hours I put into each piece, although, I may offer some discounts on larger/multiple piece orders, email for details.&nbsp; &nbsp; 4rainbowmaille@gmail.com</p> <p><br></p> {"tmenu_style":"H","default_colors":"N","link_color":"#0000ff","label_color":"#c9daf8","icon_color":"#1155cc","main_btn_color":"#1212da","branded_text_color":"#3d3dd6","vbp_1_url":"","vbp_2_url":"https:\/\/rainbowmaille.goimagine.com\/jewelry-en-23\/barrettes\/","vbp_3_url":"","vba_1_url":"","vba_2_url":"","vba_3_url":""} RainbowMaille 950 4th St. NW Cairo A RainbowMaille 950 4th St. NW Cairo GA US 39828 4rainbowmaille@gmail.com none Y 1586180082 0 a:4:{s:14:"company_fields";a:2:{i:37;s:6:"Amanda";i:38;s:6:"Risden";}s:15:"admin_firstname";s:6:"Amanda";s:14:"admin_lastname";s:6:"Risden";s:6:"fields";a:0:{}} 3 acct_1GUwe7LLlBqqIUBN 364399408646839 91884,129528,265650,147533,85256,147783 UA-177390029-1 Chainmaille jewelry & Wall Art handcrafted in the USA https://www.facebook.com/RainbowMaille https://www.instagram.com/rainbowmaille/ https://www.pinterest.com/RainbowMaille/ <p>Welcome to RainbowMaille, where all of the paintings are original works, wire trees can be custom ordered and I try to keep all the jewelry nickel free, happy shopping!</p> oauth.LzC0pQVyGc6RUdi0DcB-iCDqetPF8RtTMxv-a-q-.hlRrM6nIA0mZJvcsDjYEoyXFbtwx_3hPRuEwqfEwMuA UA-177390029-1 364399408646839 A {"items_per_file":"2500","time_from":"","time_to":""} N 0 0 0 0 0 S Professional Plan rainbowmaille 5.0000 264_486