On 12/5/2025 16:04, Maxim Boguk wrote:
On Mon, May 12, 2025 at 4:48 PM Andrei Lepikhov <lepi...@gmail.com It is not hard to write such a tiny extension. As I see, the only extra
    stored "C" procedure is needed to set up force-plan-type flag employing
    FetchPreparedStatement(). The rest of the code - querying
    pg_stat_statements and switching between plan types may be written in
    plpgsql.

    If I'm not mistaken, it will work with all PG versions that are
    currently in support. What do you think?


Such extension would be very useful (and in general - the solution based on the actual execution data - seems more stable/predictable than the plan cost based selection which is currently used by postgresql).
Okay, as far as I can see now, it costs a couple of weeks to develop. It would be more profitable in terms of speed and usage in older versions than any core patch. What's more, if, as you predict, it will work, it may provide a rationale for opening the entire plan cache for extensions and allow a wide audience to impact the extended protocol (and query plans in stored procedures) in many curious ways. As I may envision, a dummy routine providing a link to the saved_plan_list will spend a few lines of code. A subscription to cached statements may cost more time and effort but seems even more profitable.

--
regards, Andrei Lepikhov


Reply via email to