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

Query time 0.00077

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "28.69"
    },
    "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": 62,
          "rows_produced_per_join": 62,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.79",
            "eval_cost": "6.20",
            "prefix_cost": "6.99",
            "data_read_per_join": "992"
          },
          "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": 62,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "15.50",
            "eval_cost": "6.20",
            "prefix_cost": "28.69",
            "data_read_per_join": "162K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
3
5
3/14
3/20
3/21
23
5/26
5/28
4/46
71
71/75
4/76
78
3/86
5/97
78/106
109
109/110
109/116
109/117
109/118
109/123
109/124
4/125
3/178
4/46/202/22751/204
4/46/206
4/47/219
4/47/220
4/48/239
4/48/242
4/179/265
4/125/268
12/55/306
12/56/308
3/22/342/345
3/22/349/353
3/14/367
3/14/373
3/14/378
3/20087/395
411
412
413
414
415
416
417
418
419
421
422
423
424
425
426
512
3/20/964
1549
2221
3225