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

Query time 0.00248

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "25.61"
    },
    "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": 55,
          "rows_produced_per_join": 55,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.86",
            "eval_cost": "5.50",
            "prefix_cost": "6.36",
            "data_read_per_join": "880"
          },
          "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": 55,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "13.75",
            "eval_cost": "5.50",
            "prefix_cost": "25.61",
            "data_read_per_join": "143K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
2
4/45
4/48
4/50
71/73
71/74
4/76
78
3/87
71/88
4/100
78/105
78/106
78/108
109/112
109/118
109/124
2/17/147
4/179
4/45/183
4/45/191
4/100/209
4/100/213
4/76/226
4/76/227
4/52/228
4/52/229
4/48/236
4/48/238
4/48/239
4/48/242
4/51/252
4/51/253
4/179/260
5/2185
2566
3605
3606
3607
3758
3784
3802
3803
3804
5740
4/45/6634
11891
11903
13519
14265
14266
19820
20983
22165