Jon Jensen <jon@endpoint.com> writes:
> On Mon, 2 Jan 2006, Tom Lane wrote:
>> Can you demonstrate that this is actually a serious concern next to the
>> total time spent launching a backend? I can't measure any real change
>> in total time for "psql -l" when log_hostname is enabled, which should
>> be a comparable hit.
> The difference is negligible when using a UNIX socket (of course) or names
> listed in /etc/hosts. But it's certainly slower in my tests if you really
> use DNS. On a run of 1000 connections doing "psql -l", it takes 18.89s
> without the DNS lookup for log_hostname, and 31.5s with. Or run as a
> one-off, it's 0.032 to 0.041s.
Um --- I was testing a local-loopback connection, but now that I look at
the nsswitch.conf setup, it was going to /etc/hosts for that case.
Coming across the network so that a real DNS lookup is forced, there
seems to be a difference of about 4ms (note this is with a local DNS
daemon). I don't think that's significant. If it is, you've got other
performance problems anyway, and should switch to pooled connections to
reduce the number of backend launches.
regards, tom lane