Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

On one of my servers (Windows 2008 Server), creating connection in Java to PostgreSQL server takes from 1,5 to 4 seconds! I have no clue how to start checking what can be wrong. I tried different database on this server, different user. Still the same. If I work with backup of database on my computer, it's 150ms. I would be grateful for any tip where to start.

share|improve this question
    
How long it is when you try to connect to PostgreSQL by psql or telnet? –  dezso Nov 21 '12 at 18:48
1  
I answer myself - it was SSL set to on. –  Michal Nov 22 '12 at 8:04
1  
SSL is on by default on major linux distros like ubuntu and debian. It does not generally add several seconds to the connection time. As an example, I connect to PG/SSL in 0.08s locally and 0.2s remotely through a WAN. –  Daniel Vérité Nov 22 '12 at 12:49
    
It's Windows 2008, not linux. You can believe or not, turning off SSL resulted in shortening acquiring connection time and general SQL queries time :) Weird, but I am happy I am through it already. –  Michal Nov 23 '12 at 8:28
2  
I've seen similar problem when you don't have a working DNS config. This is often a problem if the server tries to resolve the hostname of better logging or authentication. –  trygvis Nov 23 '12 at 14:06

1 Answer 1

I answer myself - it was SSL set to on. Setting ssl to off in postgresql.conf solved the problem.

share|improve this answer
    
Turning off SSL - but how? Where? Only for that connection in Java or globally on the Windows server? Or in PostgreSQL? –  dezso Nov 26 '12 at 9:03
    
in PostgreSQL .conf file. It's disabled by default. –  Michal Nov 26 '12 at 12:19
    
Several seconds delay is not explainable by SSL alone (unless the system is really really badly loaded). Is this a linux DB server? I suspect most likely due to a slow /dev/random on this machine. This is very typical for login slowdown (alas normally on the client). SSL does need extra random numbers. –  eckes Nov 16 at 19:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.