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

Query time 0.00184

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "16.38"
    },
    "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": 35,
          "rows_produced_per_join": 35,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.63",
            "eval_cost": "3.50",
            "prefix_cost": "4.13",
            "data_read_per_join": "560"
          },
          "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": 35,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "8.75",
            "eval_cost": "3.50",
            "prefix_cost": "16.38",
            "data_read_per_join": "91K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
3/14
4/46
4/52
109
3/178
4/46/195
4/46/195/196
4/46/197
4/46/208
4/52/228
4/52/231
3/14/367
3/14/368
3/14/370
3/14/375
3/14/379
2566
7492/3548/7492/2873
8601/2874
2881
2885
2885/3098
2885/3532
7492/3548/7492/3548
4/46/195/22740/7651
8601/8600
11208
11209
2885/11210
13366
15528