Re: dynamic result sets support in extended query protocol

Поиск
Список
Период
Сортировка
От Shay Rojansky
Тема Re: dynamic result sets support in extended query protocol
Дата
Msg-id CADT4RqCN6eJ9hrUwbhY+-HRjZTwk03KYb6_B1t6528iYpByTuw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: dynamic result sets support in extended query protocol  (Dave Cramer <davecramer@postgres.rocks>)
Ответы Re: dynamic result sets support in extended query protocol  (Jack Christensen <jack@jncsoftware.com>)
Список pgsql-hackers
Very interesting conversation, thanks for including me Dave. Here are some thoughts from the Npgsql perspective,

Re the binary vs. text discussion... A long time ago, Npgsql became a "binary-only" driver, meaning that it never sends or receives values in text encoding, and practically always uses the extended protocol. This was because in most (all?) cases, encoding/decoding binary is more efficient, and maintaining two encoders/decoders (one for text, one for binary) made less and less sense. So by default, Npgsql just requests "all binary" in all Bind messages it sends (there's an API for the user to request text, in which case they get pure strings which they're responsible for parsing). Binary handling is implemented for almost all PG types which support it, and I've hardly seen any complaints about this for the last few years. I'd be interested in any arguments against this decision (Dave, when have you seen that decoding binary is slower than decoding text?).

Given the above, allowing the client to specify in advance which types should be in binary sounds good, but wouldn't help Npgsql much (since by default it already requests binary for everything). It would slightly help in allowing binary-unsupported types to automatically come back as text without manual user API calls, but as I wrote above this is an extremely rare scenario that people don't care much about.

> Is there really a good reason for forcing the client to issue NextResult, Describe, Execute for each of the dynamic result sets?

I very much agree - it should be possible to execute a procedure and consume all results in a single roundtrip, otherwise this is quite a perf killer.

Peter, from your original message:

> Following the model from the simple query protocol, CommandComplete really means one result set complete, not the whole top-level command. ReadyForQuery means the whole command is complete. This is perhaps debatable, and interesting questions could also arise when considering what should happen in the simple query protocol when a query string consists of multiple commands each returning multiple result sets. But it doesn't really seem sensible to cater to that

Npgsql implements batching of multiple statements via the extended protocol in a similar way. In other words, the .NET API allows users to pack multiple SQL statements and execute them in one roundtrip, and Npgsql does this by sending Parse1/Bind1/Describe1/Execute1/Parse2/Bind2/Describe2/Execute2/Sync. So CommandComplete signals completion of a single statement in the batch, whereas ReadyForQuery signals completion of the entire batch. This means that the "interesting questions" mentioned above are possibly relevant to the extended protocol as well.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Drouvot, Bertrand"
Дата:
Сообщение: Re: Add Information during standby recovery conflicts
Следующее
От: Alvaro Herrera
Дата:
Сообщение: PostgresNode::backup uses spread checkpoint?