Re: BUG #1110: psql -h localhost consults the nameservice

Lists: pgsql-bugs
From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1110: psql -h localhost consults the nameservice
Date: 2004-03-19 08:46:48
Message-ID: 20040319084648.C2169CF5037@www.postgresql.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1110
Logged by: Michael Enke

Email address: michael(dot)enke(at)wincor-nixdorf(dot)com

PostgreSQL version: 7.4

Operating system: Linux

Description: psql -h localhost consults the nameservice

Details:

If I call "psql -h localhost" it is very slow
compared to "psql -h 127.0.0.1" since for "localhost"
the nameservice is consulted.

It is reproducable best in a loop. Call 50 times:
"psql -h localhost" takes 6 seconds
"psql -h 127.0.0.1" takes 0.6 seconds
This was not the case for psql from version 7.3
May be this has something to do with changes for IP v6.

For any mail to my email address, please include
in the subject line the keyword
_no_spam_

Thank you.


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Michael Enke <michael(dot)enke(at)wincor-nixdorf(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1110: psql -h localhost consults the nameservice
Date: 2004-03-19 13:28:31
Message-ID: 200403191328.i2JDSVb27611@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

PostgreSQL Bugs List wrote:
>
> The following bug has been logged online:
>
> Bug reference: 1110
> Logged by: Michael Enke
>
> Email address: michael(dot)enke(at)wincor-nixdorf(dot)com
>
> PostgreSQL version: 7.4
>
> Operating system: Linux
>
> Description: psql -h localhost consults the nameservice
>
> Details:
>
> If I call "psql -h localhost" it is very slow
> compared to "psql -h 127.0.0.1" since for "localhost"
> the nameservice is consulted.
>
> It is reproducable best in a loop. Call 50 times:
> "psql -h localhost" takes 6 seconds
> "psql -h 127.0.0.1" takes 0.6 seconds
> This was not the case for psql from version 7.3
> May be this has something to do with changes for IP v6.

Odds are your nameserver is messed up. Try:

host localhost

and see if that is slow. I bet it is.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Michael Enke" <michael(dot)enke(at)wincor-nixdorf(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1110: psql -h localhost consults the nameservice
Date: 2004-03-19 14:51:17
Message-ID: 23955.1079707877@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org> writes:
> If I call "psql -h localhost" it is very slow
> compared to "psql -h 127.0.0.1" since for "localhost"
> the nameservice is consulted.

This is not a bug; it's supposed to do that. If you don't like it,
reconfigure your name service (see /etc/nsswitch.conf and /etc/resolv.conf).

regards, tom lane


From: "Enke, Michael" <michael(dot)enke(at)wincor-nixdorf(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1110: psql -h localhost consults the nameservice
Date: 2004-03-31 17:33:13
Message-ID: 406B00D9.7000609@wincor-nixdorf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane wrote:
> "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org> writes:
>
>>If I call "psql -h localhost" it is very slow
>>compared to "psql -h 127.0.0.1" since for "localhost"
>>the nameservice is consulted.
>
>
> This is not a bug; it's supposed to do that. If you don't like it,
> reconfigure your name service (see /etc/nsswitch.conf and /etc/resolv.conf).
>
> regards, tom lane

Ok, I'm not sure if this is a bug or not.
But definitively for postgresql version 7.3.3 on RedHat Linux,
for "localhost" it was not contacting the name service.
This difference I noticed.

Regards,
Michael