logoalt Hacker News

hans_castorp • today at 11:41 AM • 1 reply • view on HN

> To use hinting an app needs to issue a `SET` command, which adds round trip latency for each query

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.

Additionally: there is the possibility to save such a plan advice to be applied without issuing a "SET pg_plan_advice.advice" before running the statement. So this can also be applied to queries that can't be changed in the source code. This is provided by the extension pg_stash_advice


Replies

nopurpose • today at 11:55 AM

> 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.

➕ show 2 replies