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

Query time 0.00040

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "5.27"
    },
    "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": 11,
          "rows_produced_per_join": 11,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.32",
            "eval_cost": "1.10",
            "prefix_cost": "1.42",
            "data_read_per_join": "176"
          },
          "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": [
            "betaatif_store.p.category_id"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 11,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "2.75",
            "eval_cost": "1.10",
            "prefix_cost": "5.27",
            "data_read_per_join": "29K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
2
2/3
2/4
2/5
10/12
2/14
2/3/15
2/3/16
2/4/17
2/4/18
2/19
20