SELECT 
  id_path 
FROM 
  q_categories c 
  JOIN q_category_vendor_product_count p USING(category_id) 
WHERE 
  p.company_id = 64

Query time 0.00056

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "58.05"
    },
    "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": 40,
          "rows_produced_per_join": 40,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "2.05",
            "eval_cost": "8.00",
            "prefix_cost": "10.05",
            "data_read_per_join": "640"
          },
          "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": [
            "portal.p.category_id"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 40,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "40.00",
            "eval_cost": "8.00",
            "prefix_cost": "58.05",
            "data_read_per_join": "105K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
12/13/38/42
12/50/77/79
6/159/167
6/168/177
6/184/185
190/191
190/192
190/193
190/194
190/195
190/196
190/199
190/200
190/201
190/202
190/204
190/206
207
248
248/278/279/282
299
301
6/360
299/382
299/383
299/385
190/386
299/401
299/383/402
299/412/413
299/412/415
190/191/418
190/191/419
190/420
299/422/423
190/424
6/425/427
190/428
190/429
6/438/439/442
6/438/454/455
207/469/470/475
299/383/512
207/513
248/544/548
190/551
299/552
299/554
12/555
190/556
299/383/560
299/383/561
299/383/562