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

Query time 0.00075

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "29.58"
    },
    "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": 64,
          "rows_produced_per_join": 64,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.78",
            "eval_cost": "6.40",
            "prefix_cost": "7.18",
            "data_read_per_join": "1024"
          },
          "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": 64,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "16.00",
            "eval_cost": "6.40",
            "prefix_cost": "29.58",
            "data_read_per_join": "167K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
3/20
3/22
3/86
109/118
12/319/128
3/178
4/45/192
4/45/194
4/46/202/22751/203
4/46/202/22751/204
4/46/208
4/100/209
3/20/327
3/20/328
3/20/329
3/20/330
3/21/336
3/22/349
3/22/349/350
3/22/349/351
3/22/357
3/22/357/358
3/22/357/359
3/22/357/364
3/14/367
3/84/380
3/84/382
458/464
458/465/466
458/465/467
458/461/470
458/461/472
458/461/473
458/463/476
458/463/478
458/462/480
458/462/482
458/462/483
458/462/484
489/583
489/584
489/586
589/590
589/591
589/592
589/593
595/596
595/597
599
611
458/706
589/2206
458/461/2795
458/461/2796
589/5964
71/91/6654
6959
15606
595/15983
589/17909
19199/19200
19199/19201
589/21080
589/22070