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

Query time 0.00074

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "34.97"
    },
    "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": 76,
          "rows_produced_per_join": 76,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.77",
            "eval_cost": "7.60",
            "prefix_cost": "8.37",
            "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": 76,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "19.00",
            "eval_cost": "7.60",
            "prefix_cost": "34.97",
            "data_read_per_join": "198K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
2
2/13
3/14
2/15
2/16
2/18
2/19
3/22
23/38/37
8/42
71
71/72
2/82
3/87
109/110
109/112
109/116
109/118
12/319/128
2/13/132
2/13/133
2/17/147
2/15/169
2/18/170
2/18/172
2/18/173
2/18/174
2/18/175
181
4/45/183
4/46/205
2/326
2312
2312/2313
2312/2314
2312/2315
2316/2317
2316/2318
2312/2319
2312/2320
2312/2321
2312/2322
2323
2323/2324
2325
2323/2326
2323/2327
2323/2328
2323/2330
2312/2331
2325/2332
2325/2333
2325/2334
2325/2333/2335
2336/2339
2336/2337/2340
2336/2337/2341
2336/2337/2342
2336/2338/2343
2336/2338/2344
2316/2348
2349/2350
2360
2642
3453
8587
8587/8588
8587/8589
2325/8696
11387/11388
11387/11389
11387/11390
12711
11387/17076
21627