I\'m having a really difficult time debugging this problem. Whenever I try to establish a connection with postgres, it takes a whole minute. After the connection is establis
Almost 7 years later and this is still an issue...
Turning the "temp" key off helps but it's a nuisance to enable properties one-by-one that would be auto-configured (see other answers).
In case of Oracle and Teradata I didn't notice such a slowdown so I digged deep and found where the slowest part is: https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java#L2237
This resultSet has in my case 372 rows (types). Then, for each driver fires couple of calls from https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java#L204 which results in tons of SQL statements against the DB.
No idea how to speed this up right now, luckily it's needed once and then it's cached.