fix postgresql to work with scaling