SELECT 
  categories.category_id, 
  categories.parent_id, 
  categories.id_path, 
  category_descriptions.category, 
  categories.position, 
  categories.status, 
  categories.company_id 
FROM 
  categories 
  LEFT JOIN category_descriptions ON categories.category_id = category_descriptions.category_id 
  AND category_descriptions.lang_code = 'en' 
WHERE 
  1 = 1 
  AND (
    categories.usergroup_ids = '' 
    OR FIND_IN_SET(0, categories.usergroup_ids) 
    OR FIND_IN_SET(1, categories.usergroup_ids)
  ) 
  AND categories.status IN ('A') 
  AND categories.level <= 3 
  AND categories.deleted_at IS NULL 
  AND categories.company_id = 3286 
ORDER BY 
  categories.is_trash asc, 
  categories.position asc, 
  category_descriptions.category asc

Query time 0.03988

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "1152.86"
    },
    "ordering_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "nested_loop": [
        {
          "table": {
            "table_name": "categories",
            "access_type": "ref",
            "possible_keys": [
              "c_status",
              "index_categories_on_deleted_at"
            ],
            "key": "index_categories_on_deleted_at",
            "used_key_parts": [
              "deleted_at"
            ],
            "key_length": "6",
            "ref": [
              "const"
            ],
            "rows_examined_per_scan": 10182,
            "rows_produced_per_join": 33,
            "filtered": "0.33",
            "index_condition": "(`goimagine`.`categories`.`deleted_at` is null)",
            "cost_info": {
              "read_cost": "120.75",
              "eval_cost": "3.39",
              "prefix_cost": "1138.95",
              "data_read_per_join": "88K"
            },
            "used_columns": [
              "category_id",
              "parent_id",
              "id_path",
              "level",
              "company_id",
              "usergroup_ids",
              "status",
              "position",
              "is_trash",
              "deleted_at"
            ],
            "attached_condition": "((`goimagine`.`categories`.`company_id` = 3286) and ((`goimagine`.`categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`goimagine`.`categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`goimagine`.`categories`.`usergroup_ids`))) and (`goimagine`.`categories`.`status` = 'A') and (`goimagine`.`categories`.`level` <= 3))"
          }
        },
        {
          "table": {
            "table_name": "category_descriptions",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "goimagine.categories.category_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 33,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "10.52",
              "eval_cost": "3.39",
              "prefix_cost": "1152.86",
              "data_read_per_join": "154K"
            },
            "used_columns": [
              "category_id",
              "lang_code",
              "category"
            ]
          }
        }
      ]
    }
  }
}

Result

category_id parent_id id_path category position status company_id
13311 12956 12956/13311 1:12 scale miniatures 0 A 3286
13312 12956 12956/13312 1:144 scale miniatures 0 A 3286
12085 12083 12086/12083/12085 Abstract Pour Paintings 0 A 3286
12089 12083 12086/12083/12089 Alcohol Ink Paintings 0 A 3286
13244 12083 12086/12083/13244 Blacklight and Glow in the dark paitings 0 A 3286
12109 12108 12108/12109 Charcuterie Boards 0 A 3286
13045 12108 12108/13045 Christmas Grapevine wreaths 0 A 3286
12090 0 12090 Diorama 0 A 3286
12088 12083 12086/12083/12088 Floral Paintings 0 A 3286
12111 12108 12108/12111 Furniture accessories 0 A 3286
12113 12108 12108/12113 Hooks and Hangers 0 A 3286
12084 12083 12086/12083/12084 Sculptural Paintings 0 A 3286
12110 12108 12108/12110 Shelves and boxes 0 A 3286
12112 12108 12108/12112 Signs 0 A 3286
13302 12083 12086/12083/13302 5" x 7" and smaller 1 A 3286
13571 12083 12086/12083/13571 8" x 8" 1 A 3286
12086 0 12086 Art 1 A 3286
12083 12086 12086/12083 Paintings 1 A 3286
13303 12083 12086/12083/13303 8" x 10" 2 A 3286
12956 0 12956 Miniatures 2 A 3286
12087 12086 12086/12087 Wooden Wall Art 2 A 3286
13304 12083 12086/12083/13304 8" x 16" 3 A 3286
13572 12083 12086/12083/13572 9" x 12" 3 A 3286
12108 0 12108 Housewares 3 A 3286
13305 12083 12086/12083/13305 11" x 14" 4 A 3286
13573 12083 12086/12083/13573 12" x 16" 4 A 3286
12082 0 12082 Cabinet Knobs 4 A 3286
12114 0 12114 Rocks,Crystals, and Semiprecious stones 4 A 3286
13306 12083 12086/12083/13306 12" x 12" 5 A 3286
12115 0 12115 Jewelry 5 A 3286
13308 12083 12086/12083/13308 12" x 24" 6 A 3286
11965 0 11965 Croc Crystals 6 A 3286
13307 12083 12086/12083/13307 14" x 14" 7 A 3286
12116 0 12116 Games 7 A 3286
13309 12083 12086/12083/13309 16" x 20" 8 A 3286
12117 0 12117 Pet Products 8 A 3286
13310 12083 12086/12083/13310 18" x 24" 9 A 3286
12118 0 12118 Birdhouses and Birdfeeders 9 A 3286
13512 0 13512 Log/Timber creations- NOT SHIPPABLE 10 A 3286