SELECT 
  cscart_companies.company_id, 
  cscart_companies.lang_code, 
  cscart_companies.email, 
  cscart_companies.timestamp, 
  cscart_companies.status, 
  company_descr.i18n_company as company, 
  cscart_companies.tax_number, 
  cscart_company_descriptions.company_description, 
  cscart_companies.paypal_commerce_platform_account_id, 
  cscart_companies.stripe_connect_account_id, 
  absolute_rating.rating AS absolute_vendor_rating, 
  cscart_vendor_plan_descriptions.plan, 
  cscart_seo_names.name as seo_name, 
  cscart_seo_names.path as seo_path, 
  AVG(
    cscart_discussion_rating.rating_value
  ) AS average_rating, 
  CONCAT(
    cscart_companies.company_id, 
    '_', 
    IF (
      cscart_discussion_rating.thread_id, 
      cscart_discussion_rating.thread_id, 
      '0'
    )
  ) AS company_thread_ids 
FROM 
  cscart_companies 
  LEFT JOIN cscart_company_descriptions as company_descr ON company_descr.company_id = cscart_companies.company_id 
  AND company_descr.lang_code = 'en' 
  LEFT JOIN cscart_company_descriptions ON cscart_company_descriptions.company_id = cscart_companies.company_id 
  AND cscart_company_descriptions.lang_code = 'en' 
  LEFT JOIN cscart_absolute_rating AS absolute_rating ON absolute_rating.object_id = cscart_companies.company_id 
  AND absolute_rating.object_type = 'company' 
  LEFT JOIN cscart_vendor_plan_descriptions ON cscart_companies.plan_id = cscart_vendor_plan_descriptions.plan_id 
  AND cscart_vendor_plan_descriptions.lang_code = 'en' 
  LEFT JOIN cscart_seo_names ON cscart_seo_names.object_id = cscart_companies.company_id 
  AND cscart_seo_names.type = 'm' 
  AND cscart_seo_names.dispatch = '' 
  AND cscart_seo_names.lang_code = 'en' 
  LEFT JOIN cscart_discussion ON cscart_discussion.object_id = cscart_companies.company_id 
  AND cscart_discussion.object_type = 'M' 
  LEFT JOIN cscart_discussion_posts ON cscart_discussion_posts.thread_id = cscart_discussion.thread_id 
  AND cscart_discussion_posts.status = 'A' 
  LEFT JOIN cscart_discussion_rating ON cscart_discussion.thread_id = cscart_discussion_rating.thread_id 
  AND cscart_discussion_rating.post_id = cscart_discussion_posts.post_id 
WHERE 
  1 
  AND cscart_companies.status = 'A' 
GROUP BY 
  company_thread_ids 
ORDER BY 
  company_descr.i18n_company asc 
LIMIT 
  0, 10

Query time 0.00128

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "17.23"
    },
    "ordering_operation": {
      "using_filesort": true,
      "grouping_operation": {
        "using_temporary_table": true,
        "using_filesort": false,
        "nested_loop": [
          {
            "table": {
              "table_name": "absolute_rating",
              "access_type": "system",
              "possible_keys": [
                "PRIMARY"
              ],
              "rows_examined_per_scan": 0,
              "rows_produced_per_join": 1,
              "filtered": "0.00",
              "const_row_not_found": true,
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.10",
                "prefix_cost": "0.00",
                "data_read_per_join": "112"
              },
              "used_columns": [
                "object_id",
                "object_type",
                "rating"
              ]
            }
          },
          {
            "table": {
              "table_name": "cscart_companies",
              "access_type": "ALL",
              "rows_examined_per_scan": 38,
              "rows_produced_per_join": 3,
              "filtered": "10.00",
              "cost_info": {
                "read_cost": "5.45",
                "eval_cost": "0.38",
                "prefix_cost": "5.83",
                "data_read_per_join": "26K"
              },
              "used_columns": [
                "company_id",
                "status",
                "lang_code",
                "email",
                "timestamp",
                "tax_number",
                "plan_id",
                "stripe_connect_account_id",
                "paypal_commerce_platform_account_id"
              ],
              "attached_condition": "(`wearethehelpful_scalesta_net`.`cscart_companies`.`status` = 'A')"
            }
          },
          {
            "table": {
              "table_name": "company_descr",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "company_id",
                "lang_code"
              ],
              "key_length": "10",
              "ref": [
                "wearethehelpful_scalesta_net.cscart_companies.company_id",
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 3,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.38",
                "prefix_cost": "6.21",
                "data_read_per_join": "6K"
              },
              "used_columns": [
                "company_id",
                "lang_code",
                "i18n_company"
              ]
            }
          },
          {
            "table": {
              "table_name": "cscart_company_descriptions",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "company_id",
                "lang_code"
              ],
              "key_length": "10",
              "ref": [
                "wearethehelpful_scalesta_net.cscart_companies.company_id",
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 3,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.38",
                "prefix_cost": "6.59",
                "data_read_per_join": "6K"
              },
              "used_columns": [
                "company_id",
                "lang_code",
                "company_description"
              ]
            }
          },
          {
            "table": {
              "table_name": "cscart_vendor_plan_descriptions",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "plan_id",
                "lang_code"
              ],
              "key_length": "10",
              "ref": [
                "wearethehelpful_scalesta_net.cscart_companies.plan_id",
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 3,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.38",
                "prefix_cost": "6.97",
                "data_read_per_join": "2K"
              },
              "used_columns": [
                "plan_id",
                "lang_code",
                "plan"
              ]
            }
          },
          {
            "table": {
              "table_name": "cscart_seo_names",
              "access_type": "ref",
              "possible_keys": [
                "PRIMARY",
                "dispatch"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "object_id",
                "type",
                "dispatch",
                "lang_code"
              ],
              "key_length": "206",
              "ref": [
                "wearethehelpful_scalesta_net.cscart_companies.company_id",
                "const",
                "const",
                "const"
              ],
              "rows_examined_per_scan": 2,
              "rows_produced_per_join": 7,
              "filtered": "100.00",
              "index_condition": "<if>(is_not_null_compl(cscart_seo_names), (`wearethehelpful_scalesta_net`.`cscart_seo_names`.`object_id` = `wearethehelpful_scalesta_net`.`cscart_companies`.`company_id`), true)",
              "cost_info": {
                "read_cost": "1.90",
                "eval_cost": "0.76",
                "prefix_cost": "9.63",
                "data_read_per_join": "12K"
              },
              "used_columns": [
                "name",
                "object_id",
                "type",
                "dispatch",
                "path",
                "lang_code"
              ]
            }
          },
          {
            "table": {
              "table_name": "cscart_discussion",
              "access_type": "eq_ref",
              "possible_keys": [
                "object_id"
              ],
              "key": "object_id",
              "used_key_parts": [
                "object_id",
                "object_type"
              ],
              "key_length": "6",
              "ref": [
                "wearethehelpful_scalesta_net.cscart_companies.company_id",
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 7,
              "filtered": "100.00",
              "index_condition": "<if>(is_not_null_compl(cscart_discussion), (`wearethehelpful_scalesta_net`.`cscart_discussion`.`object_id` = `wearethehelpful_scalesta_net`.`cscart_companies`.`company_id`), true)",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.76",
                "prefix_cost": "10.39",
                "data_read_per_join": "182"
              },
              "used_columns": [
                "thread_id",
                "object_id",
                "object_type"
              ]
            }
          },
          {
            "table": {
              "table_name": "cscart_discussion_posts",
              "access_type": "ref",
              "possible_keys": [
                "thread_id",
                "thread_id_2"
              ],
              "key": "thread_id",
              "used_key_parts": [
                "thread_id"
              ],
              "key_length": "3",
              "ref": [
                "wearethehelpful_scalesta_net.cscart_discussion.thread_id"
              ],
              "rows_examined_per_scan": 2,
              "rows_produced_per_join": 15,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "3.80",
                "eval_cost": "1.52",
                "prefix_cost": "15.71",
                "data_read_per_join": "6K"
              },
              "used_columns": [
                "post_id",
                "thread_id",
                "status"
              ],
              "attached_condition": "<if>(is_not_null_compl(cscart_discussion_posts), (`wearethehelpful_scalesta_net`.`cscart_discussion_posts`.`status` = 'A'), true)"
            }
          },
          {
            "table": {
              "table_name": "cscart_discussion_rating",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "thread_id"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "post_id"
              ],
              "key_length": "3",
              "ref": [
                "wearethehelpful_scalesta_net.cscart_discussion_posts.post_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 15,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "1.52",
                "prefix_cost": "17.23",
                "data_read_per_join": "243"
              },
              "used_columns": [
                "rating_value",
                "post_id",
                "thread_id"
              ],
              "attached_condition": "<if>(is_not_null_compl(cscart_discussion_rating), (`wearethehelpful_scalesta_net`.`cscart_discussion_rating`.`thread_id` = `wearethehelpful_scalesta_net`.`cscart_discussion`.`thread_id`), true)"
            }
          }
        ]
      }
    }
  }
}

Result

company_id lang_code email timestamp status company tax_number company_description paypal_commerce_platform_account_id stripe_connect_account_id absolute_vendor_rating plan seo_name seo_path average_rating company_thread_ids
20 en jo@20.photos 1729088662 A 20 Photos acct_1QoQj0GPVLFl3Nhi LAUNCH - 10% 20-photos-en 20_0
36 en hello@aile-holistic.com 1744042295 A àile - (aile holistic ltd) SC733466 - company number acct_1RNx39FMcLUvBs1r Launch - 20% aile-aile-holistic-ltd 36_0
39 en becky6712@gmail.com 1745594552 A Align Services 3389720280 acct_1RMDfUFQrLs0BgV1 LAUNCH - 10% align-services 39_0
43 en hello@anaraskincare.com 1752815663 A Anara Skincare 336015529 acct_1S7x0CFDtxXZl0h6 Launch - 20% anara-skincare 43_0
38 en bert@bertsbooks.co.uk 1744972507 A Bert's Books 360815210 acct_1E4t9OAyC1e3NrFY Launch - 15% berts-books 38_0
17 en jadesleepnanny@gmail.com 1728471244 A Beyond The Stars - Jade Sleep Nanny <p>Infant & Child Sleep Consultant - specialising in bespoke solutions to sleep challenges. Responsive and holistic practices to bring contented settles and sleep for the whole family. </p> acct_1JJ2mPKqy1SoXA9T LAUNCH - 10% beyond-the-stars-jade-zammit-sleep-coaching 17_0
33 en helen@dookofedinburgh.com 1741027039 A Dook GB400891616 acct_1I8pnPJmZepdL6JN Launch - 20% dook 33_0
34 en decant.organise.time@gmail.com 1741177629 A dot. Professional Organisers (Decant.Organise.Time Limited) acct_1R7EIeJoqHai7DjG Launch - 15% dot-professional-organisers-decant-organise-time-limited 34_0
32 en danielle@eco-able.co.uk 1739787043 A Eco-Able Ltd acct_1G1tV0BKZKFcIMde Launch - 15% eco-able-ltd 32_0
30 en laurenvassanderson@gmail.com 1737449776 A Elevate by Lauren <p>Lauren has created powerful and endorphin boosting sessions to support and refine your holistic goals. Using the Pilates principles; Breath, Concentration, Control, Precision, Centre and Flow classes are catered to all levels regardless of your age, gender, health status or fitness level. Let her inspire you! With over 150+ classes to chose from, weekly schedules and challenges, Elevate by Lauren will transform and refine your movement. Building a stronger body and mind for your future self.</p><p> Including a dedicated 40 week guided Pregnancy Pilates series approved by physios filmed throughout her own pregnancy,  and a post natal Restore your Core programme created to help mothers heal and restore post birth. Suitable for both C-section and vaginal births.</p> acct_1NkWmHCV52I8Gqy2 Launch - 20% elevate-by-lauren 30_0