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

Query time 0.00119

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "53.07"
    },
    "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": 116,
          "rows_produced_per_join": 116,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.88",
            "eval_cost": "11.60",
            "prefix_cost": "12.48",
            "data_read_per_join": "1K"
          },
          "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": 116,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "29.00",
            "eval_cost": "11.60",
            "prefix_cost": "53.08",
            "data_read_per_join": "303K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
5
3/20
3/21
3/22
5/26
4/45
71/73
78
3/87
109/112
109/114
109/116
109/117
109/118
181
4/45/183
4/45/189
4/46/202/22751/203
4/47/219
4/179/266
12/55/305
3/20/329
3/22/357
3/22/357/364
3/14/367
3/14/378
5/2185
2566
4028/3272
4036/3274
4036/3275
3276
4036/3278
4034/3279
4036/3280
3281
3283
4036/3285
4036/3286
3287
4028/4027
4028
4028/4029
4028/4030
4028/4031
4028/4032
4034/4033
4034
4034/4035
4036
4037
4034/4038
3283/4039
3283/4040
3283/4041
3283/4042
3283/4043
3283/4044
3283/4045
3283/4046
3276/4047
4036/4049
4034/4050
4034/4051
4034/4052
3281/4054
3281/4055
4034/4056
4034/4057
3283/4058
4037/4059
4037/4065
4037/4067
4036/4068
4034/4069
3283/4070
4034/4071
4034/4072
4034/4073
4028/4074
4028/4075
4034/4076
4036/4088
4034/4090
4037/4104
4037/4105
4037/4106
4034/4302
4037/4303
4036/4307
4034/4308
4311
4028/6176
4034/6177
3283/6191
4028/6541
6542/6543
6542/6544
6542/6545
4034/6546
3283/6548
5/26/6692
6542/11838
4034/11839
11841
11841/11842
4037/12483
4037/13750
11841/13751
11841/13752
4036/13817
4037/13818