SELECT 
  id_path 
FROM 
  netting_categories 
WHERE 
  category_id IN (
    265, 266, 267, 282, 284, 285, 286, 288, 
    289
  )

Query time 0.00043

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "table": {
          "table_name": "netting_categories",
          "access_type": "range",
          "possible_keys": ["PRIMARY", "p_category_id"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["category_id"],
          "rows": 9,
          "filtered": 100,
          "index_condition": "netting_categories.category_id in (265,266,267,282,284,285,286,288,289)"
        }
      }
    ]
  }
}

Result

id_path
265
265/266
265/266/267
282
282/284
282/285
282/286
282/288
282/289