nightly
nightly

Reputation: 11

Postgresql is very slow

I try write simple PostgreSQL query from c#. First connection.open() takes 20 seconds. Other connections perform in momently.

PGAdmin work very slow too. If I opened "view all rows" it's takes about 10-15 seconds too (data is very few). Same perform if I opened SQL queries window.

I try this on 2 different computers with win7 and win8. In both machines Postgres work same. So is it normal that PostgreSQL works like this or am I doing something wrong?

I think problem begin from postgresql service running. After postgresql client installed service is running automatically. After some time it's stopped and I can't run it. If I try run service from cmd with pg_ctl I get:

FATAL: could not create any TCP/IP sockets

And I can connect with pgadmin to postgresql, but it work very slow.

Upvotes: 1

Views: 6969

Answers (2)

Schwern
Schwern

Reputation: 164639

Try turning off log_hostname in postgresql.conf on the server.

log_hostname (boolean)

By default, connection log messages only show the IP address of the connecting host. Turning this parameter on causes logging of the host name as well. Note that depending on your host name resolution setup this might impose a non-negligible performance penalty. This parameter can only be set in the postgresql.conf file or on the server command line.

Skimmed from this answer on Server Fault.

Upvotes: 3

jjanes
jjanes

Reputation: 44137

That is not normal.

If the first connection takes 20 seconds and the rest are instantaneous, it sounds like have a DNS problem or some other network problem unrelated to PostgreSQL itself.

Upvotes: 5

Related Questions