Perform count from postgres