Magnus Hagander <magnus(at)hagander(dot)net> writes:
> One thing that could be taking the time is an extra roundtrip -- e.g. it
> tries to connect with ssl fails and retries without.
I'd assume a priori that that's it. If so, the fix is to configure libpq
to try non-SSL first not SSL first. There is an option for that, IIRC.
regards, tom lane