Is there a way to bypass SQL completely, and somehow give the Postgres the plan to execute? So targeting their intermediate language (i presume, it is not stable?) instead of the front one
There are hooks for the planner and the executor, so you could force their hand quite easily with a plan extracted from a previous EXPLAIN. Being able to pass a plan at protocol level would be more efficient, for sure. I’ve worked on Postgres-XC and somewhat Postgres-XL, and that’s something that we wanted to do to generate a plan on one node, and push down the compiled plan down to other nodes to avoid the overhead of the plan computation. This stuff did that for snapshots and a few more things with an extension of the protocol.
MSSQL lets you save a query plan as XML then upload to another system as a hint. PG could do this using the json or xml output of EXPLAIN.
That's an interesting idea. Might be a good ability for someone to add. :)
Oracle had it for decades - ie outlines.
Not sure why this is down voted, I also looked into this at some point but was unable to find a solution.