logoalt Hacker News

hans_castorp • today at 12:10 PM • 1 reply • view on HN

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.


Replies

nopurpose • today at 12:48 PM

They are orthogonal. You can still do pg_stash_advice based on a query id AND have plan hint embedded in the query for cases where stashed hint is not set.

They solve different problems:

- SET syntax, or query comment like in third-party pg_hint_plan extension, are for app developers to embed desired hint into the code

- pg_stash_advice, or 'hint_plan.hints' table from pg_hint_plan, is a tool to get out of a pickle when query suddenly starts to misbehave and rebuilding and redeploying app with a new hint is not an option or will take too much time.