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

Query time 0.00097

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.73"
    },
    "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.66",
            "eval_cost": "0.10",
            "prefix_cost": "1.69",
            "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.12",
            "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.73",
            "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
2037 en <p></p> <p>It is funny how you start doing things and the next thing you know you are selling some. My shop journey started several years ago when I answered an ad for a planner I was looking to buy. The guy selling the planer had a old scroll saw for sale also. The price was good on both, so I bought both. I had never cut anything on a scroll saw, but I have made a great deal of things out of wood. I found a pattern book at thrift store and made a few things for a craft fair I was doing. Mostly plywood ornaments you put in house plant pots. I started to make some crosses and Christmas ornaments for my daughter and grand kids to sell a church craft fair. My interest was more in building outdoor wood furniture. I made a few sets and sold them, but was never able to really get it off the ground. Fast forward to now, I found that I was drawn back to the scroll saw and wanted to concentrate more on doing wood ornaments for all occasions , wood signs and layered wildlife wall decor. I love the artistry of the scroll saw. Taking a piece of wood and with about 10 to 100 cuts it is transformed into a beautiful piece of art a real heirloom. Each internal cut requires a very small hole. Just large enough to get the saw blade through.&nbsp;&nbsp;<br>Morning are my most productive time. I get up , do my devotions and then spend an hour to an hour and a half running my scroll saw. Once I finish a piece it is sanded smooth, the dust is vacuumed off and then finished with linseed oil.</p> <p></p> <p>I gladly accept returns and exchanges </p> <p>Contact me within 14 days of delivery </p> <p>Ship items back within 30 days of delivery<br></p> <p>I do not accept cancellations </p> <p>But please contact me if you have any problems with your order. </p> <p>The following items cannot be returned or exchanged </p> <p>Because of the nature of these items, unless they arrive damaged or defective, I cannot accept returns for: </p> <ul> <li>Custom or personalized orders</li></ul> <p>Conditions of return </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>&nbsp;</p> <p>Custom orders are always welcome from personalized ornaments to signs with that special message. </p> <p>Is everything really hand cut </p> <p>We cut everything on a scroll saw. At no time do we use a computer aided machine to cut anything we sell. Because of this, you are getting an heirloom, one of a kind item. </p> <p>How are your item finished? </p> <p>We finish everything with linseed oil. Linseed seed gives the wood a beautiful natural finish. Some of our pieces are stained first before the linseed oil finish is applied. </p> <p>Care instructions </p> <p>Because our pieces are finished with linseed oil, they require very little maintenance, and the finish will last several years. If your piece needs to be freshened up. All is required is to reapply the linseed oil by pouring the linseed oil on the piece and placing on a paper towel to soak up the excess linseed oil. Then pat the price with paper towels to remove the remaining linseed oil. Let dry for a few hours on a paper towel. Now it should look as good as new. Please note that paper towel should always be used, and never should cloth towels should be used due to the reaction that oil and cloth have. Oil on a cloth cause a chemical reaction that makes them burst into flames. </p> <p><br></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":"https:\/\/goimagine.com\/richs-wood-shop\/?category_id=11903","vbp_3_url":"","vba_1_url":"https:\/\/richswoodshop.net\/outdoor-furniture\/","vba_2_url":"https:\/\/goimagine.com\/richs-wood-shop\/?category_id=3804","vba_3_url":""} Rich’s Wood Shop 220 S. Orange St Orange A Rich’s Wood Shop 220 S. Orange St Orange US 92866 richswoodshop@gmail.com none Y 1618938664 0 3 acct_1Ir7STLPNSOAqREG 493709881776852 283328,269118,187599,82649,82647,82663,82662 UA-41302983-2 RWMQRY3XRYNR6 Personalized gifts for those special ones even if that is you. <p></p> <p>Welcome to Rich's wood shop, where handmade really means something. </p> <p>&nbsp; </p> <p>&nbsp;In today's world of computers and make it fast production, Rich's Wood Shop still make things by hand.</p> oauth.dJNgN7ep8z4YSP6_TgtS3VdiuS1roBTrCYALrGGj.Wpv233LTmypPbWc5eZTx-XTkbYaKwxLhPsepy056uBI UA-41302983-2 493709881776852 Richswoodshop.net A N 0 0 0 0 0 S Professional Plan richs-wood-shop 5.0000 2037_489511