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

Query time 0.00215

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "20.04"
    },
    "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": 43,
          "rows_produced_per_join": 43,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.69",
            "eval_cost": "4.30",
            "prefix_cost": "4.99",
            "data_read_per_join": "688"
          },
          "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": 43,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "10.75",
            "eval_cost": "4.30",
            "prefix_cost": "20.04",
            "data_read_per_join": "112K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
2
3
2/18
3/20
3/21
3/22
23
4/45
4/47
109/110
109/112
109/114
109/115
109/117
109/118
109/123
4/125
12/319/128
4/45/189
4/46/202
4/47/216
4/47/217
4/47/220
4/76/221
4/76/222
4/76/226
4/125/268
3/20/328
3/20/329
3/22/342
3/22/349
3/22/349/350
3/22/349/351
3/22/349/353
3/20/964
1083
1112
1118
1119
1121
1122
8403
9501