SELECT 
  cscart_categories.category_id, 
  cscart_categories.parent_id, 
  cscart_categories.id_path, 
  cscart_category_descriptions.category, 
  cscart_categories.position, 
  cscart_categories.status, 
  cscart_categories.company_id, 
  cscart_categories.storefront_id, 
  cscart_categories.product_count, 
  cscart_seo_names.name as seo_name, 
  cscart_seo_names.path as seo_path 
FROM 
  cscart_categories 
  LEFT JOIN cscart_category_descriptions ON cscart_categories.category_id = cscart_category_descriptions.category_id 
  AND cscart_category_descriptions.lang_code = 'en' 
  LEFT JOIN cscart_seo_names ON cscart_seo_names.object_id = cscart_categories.category_id 
  AND cscart_seo_names.type = 'c' 
  AND cscart_seo_names.dispatch = '' 
  AND cscart_seo_names.lang_code = 'en' 
WHERE 
  1 = 1 
  AND (
    cscart_categories.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, cscart_categories.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, cscart_categories.usergroup_ids
    )
  ) 
  AND cscart_categories.status IN ('A') 
  AND cscart_categories.id_path LIKE '6328/%' 
  AND cscart_categories.storefront_id IN (0, 1) 
  AND cscart_categories.category_id IN(
    266, 
    356, 
    393, 
    1516, 
    1936, 
    2601, 
    2653, 
    2760, 
    2851, 
    2910, 
    2912, 
    2917, 
    2985, 
    2944, 
    3002, 
    3048, 
    3046, 
    3060, 
    2916, 
    3087, 
    3080, 
    3085, 
    3095, 
    3144, 
    3185, 
    3105, 
    3224, 
    3228, 
    3231, 
    3390, 
    3407, 
    3487, 
    3532, 
    3591, 
    3631, 
    3535, 
    3617, 
    3933, 
    4001, 
    4254, 
    4003, 
    4525, 
    4693, 
    5264, 
    4299, 
    4271, 
    4313, 
    4317, 
    4257, 
    4418, 
    4321, 
    4564, 
    4575, 
    4551, 
    4746, 
    4334, 
    4903, 
    4787, 
    4973, 
    5014, 
    5030, 
    5039, 
    3648, 
    3685, 
    5152, 
    4805, 
    5098, 
    5164, 
    4933, 
    5256, 
    5270, 
    5372, 
    5495, 
    5506, 
    5511, 
    5519, 
    5522, 
    4808, 
    5597, 
    5742, 
    5821, 
    4431, 
    5968, 
    5457, 
    6343, 
    6426, 
    6288, 
    6448, 
    2920, 
    3741, 
    6579, 
    6473, 
    6809, 
    6870, 
    6897, 
    6928, 
    6975, 
    5362, 
    6980, 
    7008, 
    5847, 
    7022, 
    7093, 
    7217, 
    7135, 
    7242, 
    7301, 
    7454, 
    7464, 
    7797, 
    7849, 
    7080, 
    7435, 
    8229, 
    5684, 
    6536, 
    8356, 
    8362, 
    8440, 
    5577, 
    8784, 
    8817, 
    8823, 
    6328, 
    6340, 
    6471, 
    9052, 
    9053, 
    9289, 
    2954, 
    9386, 
    4910, 
    9434, 
    9435, 
    4701, 
    9662, 
    9697, 
    9720, 
    9997, 
    10041, 
    10260, 
    10269, 
    10300, 
    10265, 
    10334, 
    10335, 
    10336, 
    10437, 
    10438
  ) 
ORDER BY 
  cscart_categories.is_trash asc, 
  cscart_categories.position asc, 
  cscart_category_descriptions.category asc

Query time 0.00281

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "209.52"
    },
    "ordering_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "id_path",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 149,
            "rows_produced_per_join": 0,
            "filtered": "0.07",
            "cost_info": {
              "read_cost": "209.24",
              "eval_cost": "0.02",
              "prefix_cost": "209.26",
              "data_read_per_join": "649"
            },
            "used_columns": [
              "category_id",
              "parent_id",
              "id_path",
              "company_id",
              "usergroup_ids",
              "status",
              "product_count",
              "position",
              "is_trash",
              "storefront_id"
            ],
            "attached_condition": "(((`webmarco`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`webmarco`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`webmarco`.`cscart_categories`.`usergroup_ids`)) and (`webmarco`.`cscart_categories`.`status` = 'A') and (`webmarco`.`cscart_categories`.`id_path` like '6328/%') and (`webmarco`.`cscart_categories`.`storefront_id` in (0,1)) and (`webmarco`.`cscart_categories`.`category_id` in (266,356,393,1516,1936,2601,2653,2760,2851,2910,2912,2917,2985,2944,3002,3048,3046,3060,2916,3087,3080,3085,3095,3144,3185,3105,3224,3228,3231,3390,3407,3487,3532,3591,3631,3535,3617,3933,4001,4254,4003,4525,4693,5264,4299,4271,4313,4317,4257,4418,4321,4564,4575,4551,4746,4334,4903,4787,4973,5014,5030,5039,3648,3685,5152,4805,5098,5164,4933,5256,5270,5372,5495,5506,5511,5519,5522,4808,5597,5742,5821,4431,5968,5457,6343,6426,6288,6448,2920,3741,6579,6473,6809,6870,6897,6928,6975,5362,6980,7008,5847,7022,7093,7217,7135,7242,7301,7454,7464,7797,7849,7080,7435,8229,5684,6536,8356,8362,8440,5577,8784,8817,8823,6328,6340,6471,9052,9053,9289,2954,9386,4910,9434,9435,4701,9662,9697,9720,9997,10041,10260,10269,10300,10265,10334,10335,10336,10437,10438)))"
          }
        },
        {
          "table": {
            "table_name": "cscart_category_descriptions",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "webmarco.cscart_categories.category_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.11",
              "eval_cost": "0.02",
              "prefix_cost": "209.39",
              "data_read_per_join": "446"
            },
            "used_columns": [
              "category_id",
              "lang_code",
              "category"
            ]
          }
        },
        {
          "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": [
              "webmarco.cscart_categories.category_id",
              "const",
              "const",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.11",
              "eval_cost": "0.02",
              "prefix_cost": "209.52",
              "data_read_per_join": "185"
            },
            "used_columns": [
              "name",
              "object_id",
              "company_id",
              "type",
              "dispatch",
              "path",
              "lang_code"
            ]
          }
        }
      ]
    }
  }
}

Result

category_id parent_id id_path category position status company_id storefront_id product_count seo_name seo_path
10438 10437 6328/10437/10438 Cars 0 A 0 0 917 cars 6328/10437
10437 6328 6328/10437 Tires 0 A 0 0 0 tires-en 6328
9053 9052 6328/6340/6471/9052/9053 Automotive Alarm Accessories 10 A 0 0 1 automotive-alarm-accessories-en 6328/6340/6471/9052
6340 6328 6328/6340 Vehicle Parts & Accessories 10 A 0 0 34 vehicle-parts-and-accessories 6328
6471 6340 6328/6340/6471 Vehicle Safety & Security 20 A 0 0 0 vehicle-safety-and-security 6328/6340
9052 6471 6328/6340/6471/9052 Vehicle Alarms & Locks 40 A 0 0 0 vehicle-alarms-and-locks-en 6328/6340/6471