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 = 7353 
ORDER BY 
  categories.is_trash asc, 
  categories.position asc, 
  category_descriptions.category asc

Query time 0.04011

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "1156.94"
    },
    "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` = 7353) 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": "14.59",
              "eval_cost": "3.39",
              "prefix_cost": "1156.94",
              "data_read_per_join": "154K"
            },
            "used_columns": [
              "category_id",
              "lang_code",
              "category"
            ]
          }
        }
      ]
    }
  }
}

Result

category_id parent_id id_path category position status company_id
18764 19011 17805/19011/18764 Arkadelphia - Badgers 0 A 7353
18762 18641 17805/18641/18762 Arkansas School for the Blind - Lions 0 A 7353
18763 18641 17805/18641/18763 Arkansas School for the Deaf - Leopards 0 A 7353
18789 18666 18666/18789 Breastfeeding Awareness 0 A 7353
18784 18783 18783/18784 Christmas 0 A 7353
17807 0 17807 DIGITAL Designs - NO PHYSICAL PRODUCT SHIPPED 0 A 7353
18778 18773 18773/18778 Domestic Animals 0 A 7353
17808 17807 17807/17808 Embroidery Files 0 A 7353
18779 18773 18773/18779 Farm Animals 0 A 7353
18788 18783 18783/18788 Father's Day 0 A 7353
17809 17807 17807/17809 SVG Files 0 A 7353
18780 18773 18773/18780 Zoo Animals 0 A 7353
18664 18756 18756/18664 Allergy Tags 1 A 7353
18646 18641 17805/18641/18646 Arkansas Christian Academy - Knights 1 A 7353
18634 18664 18756/18664/18634 Bag Tag 1 A 7353
19011 17805 17805/19011 Clark County Teams 1 A 7353
18766 18769 18765/18769/18766 Create Your Own 1 A 7353
18775 18666 18666/18775 Custom (not yet listed below) Awareness Bag Tag 1 A 7353
18790 18781 18781/18790 Flowers 1 A 7353
18785 18772 18772/18785 For the Classroom 1 A 7353
18769 18765 18765/18769 Name Bag Tags 1 A 7353
18667 17804 18756/17804/18667 Small Bag Tag 1 A 7353
18681 18649 17805/18649/18681 Small Key Chain 1 A 7353
18684 18650 17805/18650/18684 Small Key Chain 1 A 7353
18687 18651 17805/18651/18687 Small Key Chain 1 A 7353
18690 18652 17805/18652/18690 Small Key Chain 1 A 7353
18693 18653 17805/18653/18693 Small Key Chain 1 A 7353
18696 18654 17805/18654/18696 Small Key Chain 1 A 7353
18699 18655 17805/18655/18699 Small Key Chain 1 A 7353
18702 18656 17805/18656/18702 Small Key Chain 1 A 7353
18705 18657 17805/18657/18705 Small Key Chain 1 A 7353
18708 18662 17805/18662/18708 Small Key Chain 1 A 7353
18711 18659 17805/18659/18711 Small Key Chain 1 A 7353
18719 18658 17805/18658/18719 Small Key Chain 1 A 7353
18722 18660 17805/18660/18722 Small Key Chain 1 A 7353
18725 18661 17805/18661/18725 Small Key Chain 1 A 7353
18731 18730 17805/18730/18731 Small Key Chain 1 A 7353
18736 18734 17805/18734/18736 Small Key Chain 1 A 7353
18739 18735 17805/18735/18739 Small Key Chain 1 A 7353
17805 0 17805 Sports Bag Tags 1 A 7353
18759 18758 18758/18759 State Bag Tags 1 A 7353
18773 0 18773 Animal Bag Tags 2 A 7353
18774 18666 18666/18774 Autism Awareness 2 A 7353
18635 18664 18756/18664/18635 Bag Tag + Small Allergy 2 A 7353
18645 18641 17805/18641/18645 Bauxite School District 2 A 7353
18767 18769 18765/18769/18767 Boy Names 2 A 7353
18760 18758 18758/18760 Country Bag Tags 2 A 7353
18786 18772 18772/18786 For the Teacher 2 A 7353
18770 18765 18765/18770 Initial Bag Tags 2 A 7353
18663 17804 18756/17804/18663 Large Bag Tag 2 A 7353
18682 18649 17805/18649/18682 Large Key Chain 2 A 7353
18685 18650 17805/18650/18685 Large Key Chain 2 A 7353
18688 18651 17805/18651/18688 Large Key Chain 2 A 7353
18691 18652 17805/18652/18691 Large Key Chain 2 A 7353
18694 18653 17805/18653/18694 Large Key Chain 2 A 7353
18697 18654 17805/18654/18697 Large Key Chain 2 A 7353
18700 18655 17805/18655/18700 Large Key Chain 2 A 7353
18703 18656 17805/18656/18703 Large Key Chain 2 A 7353
18706 18657 17805/18657/18706 Large Key Chain 2 A 7353
18709 18662 17805/18662/18709 Large Key Chain 2 A 7353
18712 18659 17805/18659/18712 Large Key Chain 2 A 7353
18720 18658 17805/18658/18720 Large Key Chain 2 A 7353
18723 18660 17805/18660/18723 Large Key Chain 2 A 7353
18726 18661 17805/18661/18726 Large Key Chain 2 A 7353
18732 18730 17805/18730/18732 Large Key Chain 2 A 7353
18737 18734 17805/18734/18737 Large Key Chain 2 A 7353
18740 18735 17805/18735/18740 Large Key Chain 2 A 7353
18782 18781 18781/18782 Lip Balm Holders 2 A 7353
18641 17805 17805/18641 Saline County Teams 2 A 7353
18636 18664 18756/18664/18636 Bat Tag + Small Medical 3 A 7353
18642 18641 17805/18641/18642 Benton School District 3 A 7353
18754 18666 18666/18754 Breast Cancer Awareness 3 A 7353
18683 18649 17805/18649/18683 Gear Bag Tag 3 A 7353
18686 18650 17805/18650/18686 Gear Bag Tag 3 A 7353
18689 18651 17805/18651/18689 Gear Bag Tag 3 A 7353
18692 18652 17805/18652/18692 Gear Bag Tag 3 A 7353
18695 18653 17805/18653/18695 Gear Bag Tag 3 A 7353
18698 18654 17805/18654/18698 Gear Bag Tag 3 A 7353
18701 18655 17805/18655/18701 Gear Bag Tag 3 A 7353
18704 18656 17805/18656/18704 Gear Bag Tag 3 A 7353
18707 18657 17805/18657/18707 Gear Bag Tag 3 A 7353
18710 18662 17805/18662/18710 Gear Bag Tag 3 A 7353
18713 18659 17805/18659/18713 Gear Bag Tag 3 A 7353
18721 18658 17805/18658/18721 Gear Bag Tag 3 A 7353
18724 18660 17805/18660/18724 Gear Bag Tag 3 A 7353
18727 18661 17805/18661/18727 Gear Bag Tag 3 A 7353
18733 18730 17805/18730/18733 Gear Bag Tag 3 A 7353
18738 18734 17805/18734/18738 Gear Bag Tag 3 A 7353
18741 18735 17805/18735/18741 Gear Bag Tag 3 A 7353
18768 18769 18765/18769/18768 Girl Names 3 A 7353
17804 18756 18756/17804 Medical Tags 3 A 7353
18771 18765 18765/18771 Monogrammed Bag Tags 3 A 7353
18761 17805 17805/18761 Team Names 3 A 7353
18637 18664 18756/18664/18637 Bag Tag + Large Allergy 4 A 7353
18643 18641 17805/18641/18643 Bryant School District 4 A 7353
18755 18666 18666/18755 Childhood Cancer Awareness 4 A 7353
18772 0 18772 Educational Bag Tags & More 4 A 7353
18746 17805 17805/18746 Mascots 4 A 7353
18638 18664 18756/18664/18638 Bag Tag + Large Medical 5 A 7353
18734 17805 17805/18734 Band 5 A 7353
18752 18666 18666/18752 Down Syndrome Awareness 5 A 7353
18647 18641 17805/18641/18647 Glen Rose School District 5 A 7353
18783 0 18783 Holiday Bag Tags & More 5 A 7353
18639 18664 18756/18664/18639 Bag Tag + USB Holder 6 A 7353
18649 17805 17805/18649 Baseball 6 A 7353
18644 18641 17805/18641/18644 Harmony Grove School District 6 A 7353
18751 18666 18666/18751 Infant Loss Awareness 6 A 7353
18777 0 18777 LBGTQ/Pride Bag Tags 6 A 7353
18640 18664 18756/18664/18640 Bag Tag + Injection Pen Holder 7 A 7353
18650 17805 17805/18650 Basketball 7 A 7353
18753 18666 18666/18753 Neonatal Intensive Care Unit Awareness 7 A 7353
18648 18641 17805/18641/18648 Sheridan School District 7 A 7353
18651 17805 17805/18651 Cheer 8 A 7353
18781 0 18781 Miscellaneous Bag Tags 8 A 7353
18652 17805 17805/18652 Football 9 A 7353
18765 0 18765 Names/Initials/Monogram Bag Tags 9 A 7353
18653 17805 17805/18653 Golf 10 A 7353
18758 0 18758 State/Country Bag Tags 10 A 7353
18654 17805 17805/18654 Gymnastics 11 A 7353
18776 0 18776 Women's Rights Bag Tags 11 A 7353
18655 17805 17805/18655 Hockey 12 A 7353
18656 17805 17805/18656 Lacrosse 13 A 7353
18657 17805 17805/18657 Miscellaneous 14 A 7353
18662 17805 17805/18662 Pickleball 15 A 7353
18735 17805 17805/18735 Scouts 16 A 7353
18659 17805 17805/18659 Soccer 17 A 7353
18658 17805 17805/18658 Softball 18 A 7353
18730 17805 17805/18730 Swimming 19 A 7353
18660 17805 17805/18660 Tennis 20 A 7353
18661 17805 17805/18661 Volleyball 21 A 7353