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

Query time 0.00219

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "20.45"
    },
    "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": 44,
          "rows_produced_per_join": 44,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.66",
            "eval_cost": "4.40",
            "prefix_cost": "5.06",
            "data_read_per_join": "704"
          },
          "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": 44,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "11.00",
            "eval_cost": "4.40",
            "prefix_cost": "20.46",
            "data_read_per_join": "115K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
3
3/20
3/21
4/46
78
78/105
78/106
78/108
109/111
109/112
109/114
109/116
109/117
109/118
4/45/183
4/46/195
4/46/195/196
4/100/210
4/275
3/20/329
3/21/336
3/21/337
3/21/339
3/22/357
3/22/357/358
3/14/367
3/20/964
5/24/6663
5/62/6686
6935
6936
6937
6938
7412
7572
7880
8799
10520
11352
11353
15973
19055
20849