← Back to context

Comment by amluto

21 hours ago

I would like to think that pg_hint_plan is designed in such a way that any hint it accepts must be a valid plan for the query. I’m quite confident that schemes with this property that can also express high quality plans are possible and not even excessively complicated.

This is not to say that it’s possible to genetically verify that a proposed algorithm does what you want it to — that would be undecidable or NP-hard or co-NP-hard depending on how you formulate the question.

I wouldn't be very excited about adding a 4B param model to my database deployment, but using this kind of approach while testing an app to identify query plans where Postgres is leaving performance on the table seems valuable without much risk.

  • Given the approach from the article, you can commit the hints to git and run tests for verification. The model would be used during coding.

  • If your statistics or workload change, this approach is useless. The hints are generated being generated ahead of time, taking 95hrs to do so.