The example is nonsensical so I expect it is too contrived to be useful for analyzing the actual problem.
Additionally, the total query time is under 1ms and most of it is planning time. Use a prepared statement or do something else to reduce planning time like reducing statistics target if that actually makes sense for your use case.
Else, show us something much closer to the real problem.