On Sun, 7 Jan 2024 at 07:55, vignesh C <vignes...@gmail.com> wrote: > One of the test has aborted in CFBot at [1] with:
Rebased the patchset and removed patch 0003 since it was causing the CI issue reported by vignesh and it seems much less useful and more controversial to me anyway (due to the extra required roundtrip). On Sun, 7 Jan 2024 at 09:17, Shay Rojansky <r...@roji.org> wrote: > Just to point out, FWIW, that the .NET Npgsql driver does indeed cache > RowDescriptions... The whole point of preparation is to optimize things as > much as possible for repeated execution of the query; I get that the value > there is much lower than e.g. doing another network roundtrip, but that's > still extra work that's better off being cut if it can be. Hmm, interesting. I totally agree that it's always good to do less when possible. The problem is that in the face of server side prepared statement invalidations due to DDL changes to the table or search path changes, the row types might change. Or the server needs to constantly throw an error, like it does now, but that seems worse imho. I'm wondering though if we can create a middleground, where a client can still cache the RowDescription client side when no DDL or search_patch changes are happening. But still tell the client about a new RowDescription when they do happen. The only way of doing that I can think of is changing the Postgres protocol in a way similar to this: Allow Execute to return a RowDescription too, but have the server only do so when the previously received RowDescription for this prepared statement is now invalid. This would definitely require some additional tracking at PgBouncer to make it work, i.e. per client and per server it should now keep track of the last RowDescription for each prepared statement. But that's definitely something we could do. This would make this patch much more involved though, as now it would suddenly involve an actual protocol change, and that basically depends on this patch moving forward[1]. [1]: https://www.postgresql.org/message-id/flat/cageczqtg2hcmb5gau53uuwcdc7gcnjfll6mnw0wnhwhgq9u...@mail.gmail.com
v6-0002-Completely-remove-fixed_result-from-CachedPlanSou.patch
Description: Binary data
v6-0001-Support-prepared-statement-invalidation-when-resu.patch
Description: Binary data