SELECT 
  category_id 
FROM 
  categories 
WHERE 
  id_path LIKE '12/%'

Query time 0.00055

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "20.28"
    },
    "table": {
      "table_name": "categories",
      "access_type": "range",
      "possible_keys": [
        "id_path"
      ],
      "key": "id_path",
      "used_key_parts": [
        "id_path"
      ],
      "key_length": "767",
      "rows_examined_per_scan": 90,
      "rows_produced_per_join": 90,
      "filtered": "100.00",
      "using_index": true,
      "cost_info": {
        "read_cost": "11.28",
        "eval_cost": "9.00",
        "prefix_cost": "20.28",
        "data_read_per_join": "235K"
      },
      "used_columns": [
        "category_id",
        "id_path"
      ],
      "attached_condition": "(`goimagine`.`categories`.`id_path` like '12/%')"
    }
  }
}

Result

category_id
319
128
22814
320
22815
22816
22817
22818
22819
22820
321
322
323
324
53
22787
22788
280
281
282
283
284
285
54
295
296
297
298
299
300
55
301
22793
22794
22795
22796
22797
302
22798
22799
22800
22801
303
22809
22810
22811
22812
22813
304
22802
22803
22804
22805
22806
22807
22808
305
22789
22790
22791
22792
306
56
307
308
309
310
57
286
287
288
289
290
58
22821
291
292
293
294
325
59
311
312
313
314
315
316
317
318
77