Postgresql Count Distinct Rows