First of all, you always have to prepare against connection failures.
A long running connection may drop and a new connection may not be established.
So always catch exceptions from all database interactions.
If your application uses the database rarely, it may be good to open the connection each time, because this way you can perhaps lower the max. number of connections to the server (and connections to PostgreSQL are fast!).
If your application uses the database all the time, the overhead will be too much.
As always, run some tests. If you can feel the overhead, open the connection on startup.