4 ms·
> The driver knows which types it can parse, but it doesn't know what types a given query will return. [...] Postgres could know the data types, but that means
by anarazel 7y ago
> The driver knows which types it can parse, but it doesn't know what types a given query will return. [...] Postgres could know the data types, but that means that the driver would need to first prepare the query (which is sometimes a good idea anyway, but other times the round trip isn't worth it).
We return the types of the result set separately even when not preparing. The harder part is doing it without adding roundtrips.
I've argued before that we should allow the client to specify which types it wants as binary, unless explicitly specified. IMO that's the only way to solve this incrementally from where we currently are.
> Do pipelined queries help at all here?
We really need to get the libpq support for pipelining merged :(
- jeffdavis 7y ago"I've argued before that we should allow the client to specify which types it wants as binary, unless explicitly specified. IMO that's the only way to solve this incrementally from where we currently are." I don't understand the idea, can you clarify?
- anarazel 7y agoWe should allow the client, on the protocol level, to add (and presumably remove) types to a server side list of types that can automatically be sent in binary if the result format is specified as 'auto'. That way a driver can add handling for ~10 builtin types (bytea, int[48], float[48], timestamp, ...) that matter from a size/efficiency POV, without needing to handle all the other types. That'd provide a large large fraction of the potential benefit of handling binary for all types. The reason for the server side list is that otherwise I don't see how you could do it without an added roundtrip.