Postgresql Get Number Of Rows In R