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

Query time 0.00079

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "37.41"
    },
    "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": 81,
          "rows_produced_per_join": 81,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.96",
            "eval_cost": "8.10",
            "prefix_cost": "9.06",
            "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": 81,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "20.25",
            "eval_cost": "8.10",
            "prefix_cost": "37.41",
            "data_read_per_join": "211K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
3
4
12
3/20
3/21
23
4/45
12/54
12/59
3/87
5/96
4/99
4/100
109
109/110
109/112
109/113
109/114
109/116
109/117
109/118
109/123
109/124
12/319/128
4/179
4/45/183
4/45/184
4/45/185
4/45/187
4/45/189
4/45/191
4/45/194
4/46/195
4/46/198
4/46/199
4/46/202
4/46/202/22751/203
4/46/206
4/46/208
4/100/209
4/100/211
4/47/216
4/179/260
4/99/271
4/99/273
12/54/295
12/55/302
567
588
795
1375
1396
1399
1400
1552
2586
2586/2587
2884
3440
3665
3666
3876
4473
1399/4476
1399/4477
1399/4478
4473/4479
4473/4480
4473/4481
1400/5144
1400/5145
1400/5146
1400/5147
1400/5148
5149
1400/5150
4/45/6634
4/6639/11179
16417
20810
23123