> You can send the SET and the actual SQL command as a single String (delimited by ; obviously), so there is no additional round trip required.
This works for simple protocol only, with drawbacks like no parameter binding or re-planning of every query even if repeated.
Doesn't it still support pipelining in the extended protocol though? So still no round trip?
Ah, right. Forgot about that.
But I think the approach to decouple the actual "hint" from the query still makes more sense, than requiring a change to the original query to include it into the comments. I don't know if something like pg_stash_advice would be possible without that approach.