SELECT 
  id_path 
FROM 
  categories c 
  JOIN category_vendor_product_count p USING(category_id) 
WHERE 
  p.company_id = 1522

Query time 0.00201

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "19.77"
    },
    "nested_loop": [
      {
        "table": {
          "table_name": "p",
          "access_type": "ref",
          "possible_keys": [
            "PRIMARY"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "company_id"
          ],
          "key_length": "4",
          "ref": [
            "const"
          ],
          "rows_examined_per_scan": 42,
          "rows_produced_per_join": 42,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.87",
            "eval_cost": "4.20",
            "prefix_cost": "5.07",
            "data_read_per_join": "672"
          },
          "used_columns": [
            "company_id",
            "category_id"
          ]
        }
      },
      {
        "table": {
          "table_name": "c",
          "access_type": "eq_ref",
          "possible_keys": [
            "PRIMARY",
            "p_category_id"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "category_id"
          ],
          "key_length": "3",
          "ref": [
            "goimagine.p.category_id"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 42,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "10.50",
            "eval_cost": "4.20",
            "prefix_cost": "19.77",
            "data_read_per_join": "109K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
3
3/22
8/6534/61
109
109/117
109/118
3/20/329
3/22/342
3/22/349
3/22/357
2021
2022
2022/2023
2022/2024
2022/2025
2022/2026
2022/2027
2021/2033
2021/2034
2021/2035
2021/2036
2022/2037
2021/2038
2021/2039
2566
2021/3514
2022/11430
2021/11431
2021/11432
2021/11433
2021/11435
2021/11436
2021/11437
2021/11438
2021/11439
2021/11440
2021/11441
2021/11442
2021/11654
2021/11655
2021/11656
2021/11657