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

Query time 0.00130

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "54.09"
    },
    "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": 118,
          "rows_produced_per_join": 118,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.99",
            "eval_cost": "11.80",
            "prefix_cost": "12.79",
            "data_read_per_join": "1K"
          },
          "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": 118,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "29.50",
            "eval_cost": "11.80",
            "prefix_cost": "54.09",
            "data_read_per_join": "308K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      }
    ]
  }
}

Result

id_path
2
3
4
8
12
3/14
2/17
3/20
3/22
23/36
23/38
8/41
4/45
4/46
4/47
4/48
12/54
12/56
12/59
71/74
71/75
4/76
78
3/85
3/86
3/87
78/105
78/106
78/107
109
109/110
109/112
109/114
109/115
109/117
109/118
109/123
4/125
71/126
12/319/128
2/17/147
3/178
4/45/183
4/45/189
4/45/190
4/45/191
4/46/195
4/46/202
4/46/202/22751/203
4/46/206
4/46/207
4/46/208
4/100/209
4/100/212
4/76/222
4/76/224
4/48/236
4/48/240
4/51/250
4/125/268
4/125/269
4/275
71/91/276
12/59/311
12/319/321
3/20/329
3/22/349
3/22/357
3/22/357/358
3/22/357/364
3/14/375
645
645/646
645/647
645/648
645/653
645/658
645/661/662
645/661/663
645/661/666
645/661/667
645/661/669
645/648/670
645/675
645/675/676
645/678
679
645/680
683/681
645/682
645/684
683/688
683/689
645/690
683/691
645/680/692
645/655/694
693/695
698
683/681/699
645/682/700
645/701
645/701/702
645/707
645/682/708
709
3/20/964
1190
5/2185
2566
4/48/6636
4/51/6638
4/46/195/22740/7651
11334/11343
11601
645/675/12848
23/38/22892