- Notifications
You must be signed in to change notification settings - Fork514
Description
Hi all,
I'm a newbie to rust coming from a java background. I've been doing some comparisons between tokio-postgres and the postgres jdbc driver and was curious about some of the differences I saw.
One difference was that it seemed the postges Parse message was requiring an extra round trip whereas in jdbc, the parse/bind/execute messages are inline. Here's an example captured packet for the latter:
I'm curious, what are the differences between the rust and jdbc driver implementations where the latter eliminates the extra round-trip. So far, the only thing I can tell is the rust implementation looks at the prepared statement output during the Bind phase. e.g. when making sure the caller passes the expected number of inputs:https://github.com/sfackler/rust-postgres/blob/1e1f6bff755ce8d05e300ab2d060dbced41e390a/tokio-postgres/src/query.rs#L234. On the other hand, I think jdbc calculates the expected number of inputs by parsing the sql on the client-side. Are there any other reasons or examples of dependencies on the Statement result that I'm missing? I would appreciate any insight into this.
Thanks!