Rewrite postgresql pooling