Reuse database connections

@Jon I am pretty sure it will also solve the other postgress issue which we are faicng.