SELECT 
  id_path 
FROM 
  cscart_categories c 
  JOIN cscart_category_vendor_product_count p USING(category_id) 
WHERE 
  p.company_id = 949

Query time 0.00040

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 0.03968464,
    "nested_loop": [
      {
        "table": {
          "table_name": "p",
          "access_type": "ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "4",
          "used_key_parts": ["company_id"],
          "ref": ["const"],
          "loops": 1,
          "rows": 32,
          "cost": 0.00778576,
          "filtered": 100
        }
      },
      {
        "table": {
          "table_name": "c",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY", "p_category_id"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["category_id"],
          "ref": ["u508912950_dev_2025.p.category_id"],
          "loops": 32,
          "rows": 1,
          "cost": 0.03189888,
          "filtered": 100
        }
      }
    ]
  }
}

Result

id_path
215
241/644
241/644/646
925
925/1125
925/1126
925/1127
925/1125/1393
925/1125/1395
925/1125/1396
925/1125/1397
925/1125/1398
925/1126/1401
925/1126/1402
925/1126/1405
925/1126/1406
925/1127/1408
925/1127/1411
215/1613
215/1614
1617
1617/1620
1617/1623
1617/1627
215/1613/1669
215/1613/1670
215/1613/1671
215/1613/1672
215/1614/1680
215/1683