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

Query time 0.00044

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "40.93"
    },
    "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": 28,
          "rows_produced_per_join": 28,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "1.73",
            "eval_cost": "5.60",
            "prefix_cost": "7.33",
            "data_read_per_join": "448"
          },
          "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": 28,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "28.00",
            "eval_cost": "5.60",
            "prefix_cost": "40.93",
            "data_read_per_join": "73K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
12/13/38/40
12/13/38/41
6/159/163
6/168/183
6/184/189
207/243
301
6/406/408
6/425/426
6/438/439/440/441
6/438/439/442
6/438/443/444
6/445/446/448
6/445/446/451
6/445/446/452
6/438/454/455
6/438/454/455/456
6/438/476
6/438/476/477
6/438/476/478
6/438/479
6/168/481
6/445/446/482
248/544/547
2/589/591